jQuery的等待,直到所有的网页动画完成 [英] jQuery wait till all page animations are done

查看:182
本文介绍了jQuery的等待,直到所有的网页动画完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何要等到动画与完成

I know how to wait till an animation is done with

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

和多元素以

$('#element1, #element2').promise().done(function(){
//code here
});

但我怎么等到页面上的元素完成动画的所有?我宁愿不只是摆在那,我在那里等待着每一个元素。

but how do I wait till all of the elements on the page are done animating? I would much rather not just put in every element that I'm waiting for in there.

推荐答案

要选择的当前正在动画的一切,只是做 $(:动画片)
http://api.jquery.com/animated-selector/

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
});

这篇关于jQuery的等待,直到所有的网页动画完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆