加载中...

dequeue()


概述    .dequeue( [queueName ] )

返回值:jQuery

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

  • V : 1.2.dequeue( [queueName ] )

    • queueName
      类型: String
      一个含有队列名的字符串。默认是fx,标准的效果队列。

.dequeue()被调用的时候,列队中的下一个函数将从这个列队中被移除,然后再执行。这个执行的函数中也应当直接或间接的包含 .dequeue()语句,这样才能继续执行队列中的其它函数,所以,这个序列可以继续。

示例

实例

在自定义队列函数中,使用 dequeue 来做结尾,以便队列可以继续运行下去。

<!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.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");
    $(this).dequeue();
  });
  $("div").animate({left:'10px', top:'30px'}, 700);
});
</script>
 
</body>
</html>

运行一下


还没有评论.