Understanding Animation Queues

Animations happen asynchronously with code executing, meaning that the code continues to execute while the animation is happening. So what happens if you specify another animation for an object before the first one completes? The answer is that jQuery queues up the animations and then executes them in order one after another until all are competed. That is, unless you specify queue:false in the animation options.

You need to understand the animation queue because if you allow user interactions to queue up too many animations by moving the mouse or clicking, the animations will be sluggish and behind the users’ actions.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.