jQuery: Get a promise for the end of an animation

The API is a little confusing because animate returns a reference to the element to enable chaining.
But you can do this:

$element.animate(...);
$element.promise().then(function() { ... });
Henning Koch Over 9 years ago