jquery jQuery.queue() method
Translation results:
jQuery
Instance;Event;Performance;Mobile;Basic
queue
UK[kju:] US [kju]
n. (people or vehicles) queue, queue; braid
vi. (people, vehicles, etc.) queue up and wait
vt. (make) queue up , waiting in line
jquery jQuery.queue() methodsyntax
Function: queue() method displays or operates the function queue executed on the matching element. This is a low-level method; using .queue() is more convenient.
Syntax: .queue(queueName)
Parameters:
Parameter | Description |
queueName | Optional. String value containing the name of the sequence. The default is fx, the standard effects sequence. |
Operation queue: queue() method operates the function queue executed on the matching element.
Syntax: .queue(queueName,newQueue)
##Parameters:
Description | |
Optional. String value containing the name of the sequence. The default is fx, the standard effects sequence. |
Note: Each element can have one or more function queues added by jQuery. In most applications, only one queue (named fx) is used. Queue runs asynchronously invoke sequences of actions on elements without terminating program execution. A typical example is calling multiple animation methods on an element.
jquery jQuery.queue() methodexample
<!DOCTYPE html> <html> <head> <style>div { margin:3px; width:40px; height:40px; position:absolute; left:0px; top:60px; background:green; display:none; } div.newcolor { background:blue; } p { color:red; } </style> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <p>队列长度是:<span></span></p> <div></div> <script> var div = $("div"); function runIt() { div.show("slow"); div.animate({left:'+=200'},2000); div.slideToggle(1000); div.slideToggle("fast"); div.animate({left:'-=200'},1500); div.hide("slow"); div.show(1200); div.slideUp("normal", runIt); } function showIt() { var n = div.queue("fx"); $("span").text( n.length ); setTimeout(showIt, 100); } runIt(); showIt(); </script> </body> </html>
Click the "Run instance" button to view the online instance