1 line
2.0 KiB
JSON
1 line
2.0 KiB
JSON
{"name":"clearQueue","type":"method","title":".clearQueue()","deprecated":null,"removed":null,"desc":"Remove from the queue all items that have not yet been run.","categories":["effects/custom-effects","data","utilities","version/1.4"],"entries":[{"return":"jQuery","signatures":{"added":"1.4","argument":{"desc":"A string containing the name of the queue. Defaults to <code>fx</code>, the standard effects queue.","name":"queueName","optional":"true","type":"String"}},"examples":{"desc":"Empty the queue.","code":"\n$( \"#start\" ).click(function() {\n var myDiv = $( \"div\" );\n myDiv.show( \"slow\" );\n myDiv.animate({\n left:\"+=200\"\n }, 5000 );\n\n myDiv.queue(function() {\n var that = $( this );\n that.addClass( \"newcolor\" );\n that.dequeue();\n });\n\n myDiv.animate({\n left:\"-=200\"\n }, 1500 );\n myDiv.queue(function() {\n var that = $( this );\n that.removeClass( \"newcolor\" );\n that.dequeue();\n });\n myDiv.slideUp();\n});\n\n$( \"#stop\" ).click(function() {\n var myDiv = $( \"div\" );\n myDiv.clearQueue();\n myDiv.stop();\n});\n","css":"\n div {\n margin: 3px;\n width: 40px;\n height: 40px;\n position: absolute;\n left: 0px;\n top: 30px;\n background: green;\n display: none;\n }\n div.newcolor {\n background: blue;\n }\n","html":"\n<button id=\"start\">Start</button>\n<button id=\"stop\">Stop</button>\n<div></div>\n"},"longdesc":"\n <p>When the <code>.clearQueue()</code> method is called, all functions on the queue that have not been executed are removed from the queue. When used without an argument, <code>.clearQueue()</code> removes the remaining functions from <code>fx</code>, the standard effects queue. In this way it is similar to <code>.stop(true)</code>. However, while the <code>.stop()</code> method is meant to be used only with animations, <code>.clearQueue()</code> can also be used to remove any function that has been added to a generic jQuery queue with the <code>.queue()</code> method. </p>\n "}]} |