<!DOCTYPE?html>
<html>
<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title></title>
????<style>
????p?{
????????color:?red;
????}
????
????div?{
????????width:?200px;
????????height:?100px;
????????background-color:?yellow;
????????color:?red;
????}
????a{
????????display:?block
????}
????</style>
????<script?src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
????<h2>stop</h2>
????<p>慕課網(wǎng),專注分享</p>
????<div?id="aaron">內(nèi)部動畫</div>
????<input?id="exec"?type="button"?value="執(zhí)行動畫"><br?/><br?/>
????點擊觀察動畫效果:
????<select?id="animation">
????????<option?value="1">stop()</option>
????????<option?value="2">stop(true)</option>
????????<option?value="3">stop(true,true)</option>
????</select>
????<a></a>
????<input?id="stop"?type="button"?value="停止動畫">
????<script?type="text/javascript">
????//點擊執(zhí)行動畫
????$("#exec").click(function(){
????????$("#aaron").animate({
????????????height:?300
????????},?2000)
????????$("#aaron").animate({
????????????width:?300
????????},?5000)
????????$("#aaron").animate({
????????????opacity:?0.6
????????},?2000)
????})
????$("#stop").click(function()?{
????????var?v?=?$("#animation").val();
????????var?$aaron?=?$("#aaron");
????????if?(v?==?"1")?{
????????????//當(dāng)前當(dāng)前動畫
????????????$aaron.stop()
????????}?else?if?(v?==?"2")?{
????????????//停止所以隊列
????????????$aaron.stop(true)
????????}?else?if?(v?==?"3")?{
????????????//停止動畫,直接跳到當(dāng)前動畫的結(jié)束
????????????$aaron.stop(true,true)
????????}?
????});
????</script>
</body>
</html>
2017-04-19
它長度在不斷加長,很難按到stop鍵,你換一下,讓它width先動,把高放到第二個就好了
2017-03-02
測了一下,可以用啊, 不過你那個高度變化和透明度變化太快了, 兩秒鐘就完成, 你可以不好點擊, 你把時間改長一點試一下,應(yīng)該是可以的。?
祝學(xué)習(xí)進步