How to make jquery animation functions run in parallel?

Viewed 46

I want to simulate the Bootstrap modal windows opening effect, combining fadeIn() and animate() functions. However, jQuery executes these functions in sequence, not in parallel, so the result is that the div appears and then translates.

This is the code:

    $('div')
       .delay(1000)
       .fadeIn(500)
       .animate({top: 40}, 500)
       .queue(function(a) { 
          a(); 
       });

How can I obtain a fade in and translate effect simultaneously?

Thanks

1 Answers

try wrapping the element in two separate divs. let the fadeIn effect be the parent div.

Related