2

In this code:

$('.slide').delay(2000).fadeOut(500);

Is this how to use dequeue() function? Cause it says dequeue( [ queueName ] ) in jQuery website. Because I want to dequeue the fadeOut(); Is fadeOut the queueName?

It this the way to use dequeue() function?

$('.slide').dequeue('fadeOut');

Thank you.

Ryan
  • 1,783
  • 8
  • 27
  • 42

1 Answers1

1

No it is not. There is a default queue to which all effect methods are added which is called fx. See the queue documentation:

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.

You can create other queues with other names.

The argument you pass to dequeue is the name of the queue, not of a function. So you probably want $('.slide').dequeue('fx');, which is the same as $('.slide').dequeue();.

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143