<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery清除、停止隊列中剩下(未執行的函數)</title>
<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
//clearQueue() 清除、停止隊列中剩下(未執行的函數)
$(document).ready(function(){
$("#start").click(function(){ //隊列動畫
$("div").animate({height:300},1500);
$("div").animate({width:300},1500);
$("div").animate({height:100},1500);
$("div").animate({width:100},1500);
});
$("#stop").click(function(){
$("div").clearQueue();
});
});
</script>
</head>
<body>
<button id="start">開始動畫</button>
<button id="stop">停止動畫</button>
<br><br>
<div style="background:lightpink;height:100px;width:100px;">
</div>
</body>
</html>