首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:jQuery 教程
TRY RUN / 在线示例
jQuery 教程 delay() 和 animate()
jQuery 教程 delay() 和 animate()
源代码
运行
<!DOCTYPE html> <html> <head> <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function() { $("#btn1").click(function(){ $("div").animate({height:"300px"}); $("div").animate({width:"600px"}); $("div").delay(1200).animate({height:"900px"}); }); }); </script> </head> <body> <p>This example demonstrates the animate() method with three merged boxes.</p> <p>The third box is set to delay() for 1200 milliseconds.</p> <div style="background:purple;height:100px;width:100px;margin:6px;"> </div> <p><button id="btn1">Animate</button></p> </body> </html>
运行结果