clear

英 [kl??(r)]? ?美 [kl?r]??

adj.明確的;清澈的;清楚的,明白的;清晰的,明亮的

adv.完全地;清晰地;整整

vi.變明朗;變清澈

vt.掃除,除去;消除(嫌疑);使清楚;使干凈

n.空隙,空間

queue

英 [kju:]? ?美 [kju]??

n.(人或車輛)行列,長隊(duì);辮子

vi.(人、車等)排隊(duì)等候

vt.(使)排隊(duì),列隊(duì)等待

jquery 清除隊(duì)列方法 語法

作用:clearQueue() 方法停止隊(duì)列中所有仍未執(zhí)行的函數(shù)。與 stop() 方法不同,(只適用于動畫),clearQueue() 能夠清除任何排隊(duì)的函數(shù)(通過 .queue() 方法添加到通用 jQuery 隊(duì)列的任何函數(shù))。

語法:$(selector).clearQueue(queueName)

參數(shù):

參數(shù)描述
queueName可選。規(guī)定要停止的隊(duì)列的名稱。默認(rèn)是 "fx",標(biāo)準(zhǔn)效果隊(duì)列。

jquery 清除隊(duì)列方法 示例

<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>
運(yùn)行實(shí)例 ?

點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例