jQuery wait till all page animations are done

后端 未结 2 894
南笙
南笙 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:09

    To select everything that's being animated currently, just do $(":animated") http://api.jquery.com/animated-selector/

    Combining that with what you already have there, it'd just be

    $(":animated").promise().done(function() {
        //code here
    });
    

提交回复
热议问题