Search code examples
javascriptjqueryfade

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


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?


Solution

  • 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');