fadeOut() and slideUp() at the same time?

Matthew picture Matthew · Mar 5, 2010 · Viewed 45.4k times · Source

I have found jQuery: FadeOut then SlideUp and it's good, but it's not the one.

How can I fadeOut() and slideUp() at the same time? I tried two separate setTimeout() calls with the same delay but the slideUp() happened as soon as the page loaded.

Has anyone done this?

Answer

Nick Craver picture Nick Craver · Mar 5, 2010

You can do something like this, this is a full toggle version:

$("#mySelector").animate({ height: 'toggle', opacity: 'toggle' }, 'slow');

For strictly a fadeout:

$("#mySelector").animate({ height: 0, opacity: 0 }, 'slow');