clear

UK[klɪə(r)] US[klɪr]

adj. Clear; clear; clear, clear; clear, bright

adv.completely; clearly; whole

vi.become clear; become clear

vt.sweep, remove; eliminate (suspect); make clear; Make clean

n. Gap, space

queue

英[kju:] 美[kju]

n.( people or vehicles) queue, queue; braid

vi. (people, vehicles, etc.) line up to wait

vt. (make) line up, line up to wait

jquery clearQueue method syntax

Function: clearQueue() method stops all functions in the queue that have not yet been executed. Unlike the stop() method, (which only works for animations), clearQueue() clears any queued function (any function added to the generic jQuery queue via the .queue() method).

Syntax: $(selector).clearQueue(queueName)

Parameters:

ParametersDescription
queueNameOptional. Specifies the name of the queue to stop. Default is "fx", the standard effects queue.

jquery clearQueue method example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
  $("#start").click(function(){
    $("#box").animate({height:300},"slow");
    $("#box").animate({width:300},"slow");
    $("#box").queue(function () {
      $(this).css("background-color","red");  
      $(this).dequeue();
    });
    $("#box").animate({height:100},"slow");
    $("#box").animate({width:100},"slow");
  });
  $("#stop").click(function(){
    $("#box").clearQueue();
  });
});
</script>
</head>
<body>

<p><button id="start">Start Animation</button><button id="stop">Stop Animation</button></p>
<div id="box" style="background:#98bf21;height:100px;width:100px;position:relative">
</div>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance