jQuery.dequeue()

jQuery.dequeue( element, [ queueName ] ) 官网原E文: jQuery

描述: 在匹配的元素上执行队列中的下一个函数。

  • version added: 1.3jQuery.dequeue( element, [ queueName ] )

    element一个用于移除和执行列队的DOM元素。

    queueName一个含有队列名的字符串。默认是"Fx",标准的动画队列。

注意这是一个底层的方法,你应该用.dequeue()代替。

.dequeue()被调用的时候,列队中的下一个函数将从这个列队中被移除,然后再执行。这个函数必须依次(立即或者间接地)造成.dequeue()被调用,所以,这个序列可以继续。

Example:

Use dequeue to end a custom queue function which allows the queue to keep going.

<!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 src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <button>Start</button>  <div></div>
<script>$("button").click(function () {
      $("div").animate({left:'+=200px'}, 2000);
      $("div").animate({top:'0px'}, 600);
      $("div").queue(function () {
        $(this).toggleClass("red");
         $.dequeue( this );
              });
      $("div").animate({left:'10px', top:'30px'}, 700);
    });</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版Clove整理、修订