clearqueue()方法与clearqueue()方法结合;
.clearqueue()可用于删除通过.queue()方法添加到通用jquery序列的任何函数。
示例:
<!doctype html>
<html>
<head>
<style>
p { margin:3px; width:40px; height:40px;
position:absolute; left:0px; top:30px;
background:green; display:none; }
p.newcolor { background:blue; }
</style>
<script type="text/javascript" src="/jquery/jquery.js"></script>
</head>
<body>
<button id="start">开始</button>
<button id="stop">停止</button>
<p></p>
<script>
$("#start").click(function () {
$("p").show("slow");
$("p").animate({left:'+=200'},5000);
$("p").queue(function () {
$(this).addclass("newcolor");
$(this).dequeue();
});
$("p").animate({left:'-=200'},1500);
$("p").queue(function () {
$(this).removeclass("newcolor");
$(this).dequeue();
});
$("p").slideup();
});
$("#stop").click(function () {
$("p").clearqueue();
$("p").stop();
});
</script>
</body>
</html>
以上就是jquery clearqueue相关介绍及实例讲解的详细内容。