jQuery

實(shí)例;事件;效能;移動(dòng);基礎(chǔ)

#dequeue

Swe[d?k'ju: ]? ?美[d?k'ju:]??

v.出列

jquery jQuery.dequeue() 方法 語法

作用:dequeue() 方法為符合元素執(zhí)行序列中的下一個(gè)函數(shù)。這是底層的方法;使用?.dequeue()?更方便。

語法:.dequeue(queueName)

#參數(shù):

# #參數(shù)

說明############queueName? ??######可選。字串值,包含序列的名稱。預(yù)設(shè)是 fx, 標(biāo)準(zhǔn)的效果序列。 ##################說明:###當(dāng)呼叫 .dequeue() 時(shí),會(huì)從序列中刪除下一個(gè)函數(shù),然後執(zhí)行它。該函數(shù)反過來會(huì)(直接或間接地)引發(fā)對(duì) .dequeue() 的調(diào)用,這樣序列才能繼續(xù)下去。 ###

jquery jQuery.dequeue() 方法 範(fàn)例

<!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>
執(zhí)行實(shí)例 ?

#點(diǎn)擊 "執(zhí)行實(shí)例" 按鈕查看線上實(shí)例

#