jQuery wait till all page animations are done

后端 未结 2 890
南笙
南笙 2021-02-05 06:33

I know how to wait till an animation is done with

$(\'#element\').animate(speed,function(){
//code here
});

and with multiple elements with

2条回答
  •  孤独总比滥情好
    2021-02-05 07:00

    The answer given by Jeremy T works fine - although based on the comments on the jquery site he linked (http://api.jquery.com/animated-selector/), it would be a faster solution to add a class to each element on the page that may be animated, and then select them using

        $('.animationclass').filter(':animated').promise().done(function() {
    //Your function
    });
    

提交回复
热议问题