How to queue an animation for multiple elements and wait until they finished?
Compact syntax with timing methods:
1
$('.many').animate(attributes,options,$).jQueryStuff();
The jQuery token $ is used instead of a callback function to indicate the timing version of animate().
Compare this to the old way with more syntactic fluff:
1
2
3
4
5
6
var waiting = $('.many').length;
$('.many').animate(attributes, options, function(){
if (!--waiting) {
$(this).jQueryStuff();
}
});
Similar patterns with animations
- How to wait for the elements' animation queues to get empty?
- How to wait for the end of the elements' current animations?
- How to wait for the end of the elements' current animations for a given queue name?
- How to wait for the elements' animation queues to get empty with .join()?
- How to wait for the elements' animation queues for a given queue name to get empty?
- How to queue an animation and return immediately?
- How to queue an animation for a single element and wait until it finished?