Good day, the question about jquery and the animate function - there is a block that has a part of the text hidden, when the button is pressed, the block should smoothly lower and open completely, only my code does not work, and does not work in one direction, works smoothly to close, and the opening opens immediately.
<style> #moon-slide { height: 80px; overflow: hidden; } </style> <div id="moon-slide"> <p style="text-align: justify;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercising ullamco laboris nisi ut aliquip ex ea commodo consequat. Duel aute irure dolor in voluptate in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
Read more $("#click-moon").click(function () { var moonSlide = $("#moon-slide"); if (!moonSlide.hasClass("show")) { moonSlide.animate({ height: "100%" }, 1000, function () { moonSlide.addClass('show'); }); } else { moonSlide.animate({ height: "79px" }, 1000, function () { moonSlide.removeClass('show'); }); } });