dequeue([queueName])
返回值
jQuery
概述
从队列最前端移除一个队列函数,并执行他。
参数
示例
示例一 使用 dequeue() 终止一个自定义的队列函数
$("div").queue(function () {
$(this).toggleClass("red");
$(this).dequeue();
});
示例二 用dequeue来结束自定义队列函数,并让队列继续进行下去。
//html代码
<style>
div {
margin:3px;
width:50px;
position:absolute;
height:50px;
left:10px;
top:30px;
background-color:yellow;
}
div.red {
background-color:red;
}
</style>
<button>Start</button>
<div></div>
// jQuery 代码
$("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);
});