Skip to content

How to run two jQuery animations simultaneously?

Is it possible to run two animations on two different elements simultaneously? I need the opposite of this question Jquery queueing animations.

I need to do something like this…

$('#first').animate({ width: 200 }, 200);
$('#second').animate({ width: 600 }, 200);

but to run those two at the same time. The only thing I could think of would be using setTimeout once for each animation, but I don’t think it is the best solution.


yes there is!

$(function () {
       width: '200px'
    }, { duration: 200, queue: false });

       width: '600px'
    }, { duration: 200, queue: false });