jQuery animate()元素的单个队列 [英] Single queue for jQuery animate() elements
本文介绍了jQuery animate()元素的单个队列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
默认情况下,为animate()创建的jQuery队列是按元素完成的,我想知道是否有办法为使用animate()完成的所有动画创建单个队列?即每次只能运行一个动画
By default the jQuery queue that is created for animate() is done per element, I'm wondering if there is a way to create a single queue for all animations done with animate()? I.e. only one animation should be occuring at a time
推荐答案
您可以使用队列在一个元素上使用自己的自定义队列来执行此操作:
You could do it with your own custom queue on one element using queue:
$(function(){
$('#myQueue')
.queue('myQueue',function(next){
$('#t1').animate({left: 100},
{duration: 1000,
queue: false,
complete: next
})
})
.queue('myQueue',function(next){
$('#t2').animate({left: 100},
{duration:1000,
queue:false,
complete: next})
})
/* etc. */
.dequeue('myQueue')
})
这篇关于jQuery animate()元素的单个队列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文