一个人怎么可以设置添加类的连续延误? [英] How can one set a sequential delay on adding a class?
本文介绍了一个人怎么可以设置添加类的连续延误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用jQuery UI插件和最新的jQuery。
我想按顺序逐个增加的类,一跌我的元素数组。现在,我有这样的:
$(@ EL).addClass(gridBoxComplete,400,easeOutBounce)。延迟(800)
其中, @el
是数组中的当前元素。然而,这并不在迭代的下一项目运行之前延迟该对象。我根据这个动画大概过这个念头。
$(@)隐藏()个(指数) - GT。;
$(@)
.delay(指数* 100)
.fadeIn 500
解决方案
延迟()
延迟动画,类名不改变或其它code处决。如果你想执行的通用延迟,使用的setTimeout
或类似的东西:
$。fn.wait =功能(MS,回调){
返回this.each(函数(){
的setTimeout(callback.bind(本),MS)
})
}$(@ EL).addClass(gridBoxComplete,400,easeOutBounce)。等待(800,函数(){
$(本).addClass(东西);
});
I'm using jQuery UI plugin and the latest jQuery.
I would like to sequentially add on the class, one by one down my array of elements. Right now I have this :
$(@el).addClass("gridBoxComplete", 400, "easeOutBounce").delay(800)
Where @el
is the current element in the array. This, however, does not delay this object before the next item in the iteration is run. I based this animation roughly off of this idea..
$(@).hide().each (index) ->
$(@)
.delay(index * 100)
.fadeIn 500
解决方案
delay()
delays animations, not classname changes or other code executions. If you want generic execution delay, use setTimeout
or something like:
$.fn.wait = function(ms, callback) {
return this.each(function() {
setTimeout(callback.bind(this), ms)
})
}
$(@el).addClass("gridBoxComplete", 400, "easeOutBounce").wait(800, function() {
$(this).addClass("something");
});
这篇关于一个人怎么可以设置添加类的连续延误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文