Home/Jquery/queue() Effect in Jquery

queue() Effect in Jquery

Description:

The jquery queue() method shows the queue of functions to be executed on the matched/selected elements. A queue is one or more functions waiting to run and it has several queues. Most often it has only one, the “fx” queue, which is the default jQuery queue. 

For Better Understand: 

It is an array of functions stored on a per element basis, using jQuery.data(). They work as First-In-First-Out. To understand better, we have to understand how jQuery does animation. If you write multiple animate method calls one after the other, jQuery creates an internal queue and adds these method calls to it. Then it runs those animate calls one by one.

Syntax

$(selector).queue(queueName)

queueName  Optional. Specifies the name of the queue Default is “fx”, the standard effects queue

Example:

Output:

On Click of “Click to start animation” button, the “divpanelBox” started to append (css stlyle) the new height & width for the same and started to increasing the size of the div as shown below.

jquery-queue-effects-dotnet-helpers-com-thiyagu

Example:

Output:

jquery-queue-effects-dotnet-helpers-com-thiyagu

Note :

After we build up our queue items, we have to call dequeue() on the queue in order to kick off the series of sequential events.deQueue() method . we need to use dequeue() method with queue() else the queue will not be closed and you will get undesired result.

[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]
READ  .InnerWidth() method in Jquery

Leave A Comment