编辑下面的代码:【加编码】
<html> <head> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ var div = $("div"); startAnimation(); showQueue(); function startAnimation(){ div.animate({height:300},"slow"); div.animate({width:300},"slow"); div.animate({height:100},"slow"); div.animate({width:100},"slow",startAnimation); } function showQueue(){ var q=div.queue(); $("span").text(q.length); setTimeout(showQueue); } }); }); </script> </head> <body> <button>Start Animation</button> <p>The queue length is: <span></span></p> <div style="width:50px;height:50px;position:absolute;left:10px;top:100px;background-color:red;"></div> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂