Animation Promises
jQuery animations return a Promise via .promise() that resolves when all animations on the element complete — useful for chaining animations.
jQuery animations return a Promise via .promise() that resolves when all animations on the element complete — useful for chaining animations.
$("#logo")
.fadeIn(500).promise()
.then(function() {
return $("#tagline").slideDown(400).promise();
})
.then(function() {
return $("#cta").fadeIn(300).promise();
})
.done(function() {
console.log("Intro animation complete");
});
Animation .promise() resolves when the animation queue is empty — works with any queued animation.