dequeue

UK [dɪk'ju:] US [dɪk'ju:]

v.Dequeue

jquery dequeue() method syntax

Function: The dequeue() method executes the next function in the sequence for the matching element.

Syntax: .dequeue(queueName)

Parameters:

ParameterDescription
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 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>
Run instance »

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