The accepted answer "Nick Craver" is definitely the way to go. The only thing I would add is that his answer didn't actually βhideβ it, and the DOM still sees a viable element in it for display.
This can be a problem if you have margins or indents on the slid ... they will still be displayed. So I just added the animate () function callback to hide it after the animation is complete:
$("#mySelector").animate({ height: 0, opacity: 0, margin: 0, padding: 0 }, 'slow', function(){ $(this).hide(); });
CodeKoalas Feb 20 '15 at 22:28 2015-02-20 22:28
source share