在此代码中:
$('.slide').delay(2000).fadeOut(500);
这是如何使用 dequeue() 函数吗?因为它在 jQuery 网站中显示 dequeue([queueName])。因为我想使 fadeOut() 出列; fadeOut 是queueName 吗?
这就是 dequeue() 函数的使用方法吗?
$('.slide').dequeue('fadeOut');
谢谢。
最佳答案
不,不是。有一个默认队列,所有效果方法都添加到其中,称为fx
。请参阅queue
文档:
Every element can have one to many queues of functions attached to it by jQuery. In most applications, only one queue (called
fx
) is used. Queues allow a sequence of actions to be called on an element asynchronously, without halting program execution.
您可以使用其他名称创建其他队列。
传递给dequeue
的参数是队列的名称,而不是函数的名称。因此,您可能需要 $('.slide').dequeue('fx');
,它与 $('.slide').dequeue();
相同>.
关于jquery - 队列名称是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4862738/