jQuery clearQueue() Method
Example
Stop the remaining functions in the queue:
$("button").click(function(){
$("div").clearQueue();
});
Definition and Usage
The clearQueue() method removes all items from the queue that have not yet been run. Note that when a function starts running, it runs until it is complete.
Related methods:
- queue() - Demonstrates queued functions
- dequeue() - Removes the next function from the queue, and then executes the function
Note: Unlike the stop() method (which only works for animations), the clearQueue() method removes any queued functions.
Syntax
$(selector).clearQueue(queueName)
| Parameter | Description |
|---|---|
| queueName | Optional. Specifies the name of the queue. Default is "fx", the standard effects queue. |
Try it - Example
Using queue-related methods together
How to use queue(), dequeue(), and clearQueue() together.
YouTip