+ 2


Could someone please explain me how can I use .queue() method of JQuery please?

19th Jun 2017, 2:56 AM
Alastair Rails
Alastair Rails - avatar
1 Answer
+ 5
JavaScript processes everything sequentially. That means if you have multiple .animate() methods attached to an element, they will be processed in order from the first to the last. .queue() is for viewing and manipulating the effects that are queued on an element. An example of when you might want to use this method is when you have an element that's animated around the window, and the visitor does an action (such as clicking) and you want to alter the effects on the element. Quick example: Imagine you have an element that has 4 .animate()s. If a user clicks a button you want to add an additional 2 animations, or maybe you want to remove the remaining animations that are queued.
23rd Jun 2017, 11:31 PM