jQuery Methods: queue()

By: Dusty Arlia
Published on Friday, December 27, 2013, 07:22 PM
Last Updated on Saturday, July 11, 2015 at 9:09 PM
Total Updates: 2

jQuery queues are lists of functions that are waiting to be executed. These functions execute in sequence. As soon as one function is done executing, the next function is called. This is the default behavior specified in the queue property of the options object (the second argument to the animate() method). Each element's queue is independent. Use the queue() method to add a new function to the queue. The function at the head of the queue is automatically dequeued and invoked. It is passed a single function argument (this executes the next function in the queue).

Here is an example of the queue() method:

$(".sponsor_message").delay(8000).queue(function() {
        $(this).text("A message from our sponsor");