jQuery
Instance; event; performance; mobile; foundation
dequeue
英[dɪk'ju: ] 美[dɪk'ju:]
v.Out of the queue
jquery jQuery.dequeue() method syntax
Function: The dequeue() method executes the next function in the sequence for the matching element. This is a low-level method; using .dequeue() is more convenient.
Syntax: .dequeue(queueName)
Parameters:
Parameter | Description |
queueName | Optional. String value containing the name of the sequence. The default is fx, the standard effects sequence. |
Description: When .dequeue() is called, the next function is removed from the sequence and then executed. This function in turn triggers (directly or indirectly) a call to .dequeue() so that the sequence can continue.
jquery jQuery.dequeue() method example
<!DOCTYPE html> <html> <head> <style> div { margin:3px; width:50px; position:absolute; height:50px; left:10px; top:30px; background-color:yellow; } div.red { background-color:red; } </style> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <button>开始</button> <div></div> <script> $("button").click(function () { $("div").animate({left:'+=200px'}, 2000); $("div").animate({top:'0px'}, 600); $("div").queue(function () { $(this).toggleClass("red"); $(this).dequeue(); }); $("div").animate({left:'10px', top:'30px'}, 700); }); </script> </body> </html>
Click the "Run instance" button to view the online instance