搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
JavaScript
jQuery 教程
jQuery 效果
源代码
清空
点击运行
<!DOCTYPE html> <html> <title>jQuery 开始、停止动画示例1 - 基础教程(div.cn)</title> <head> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#btn1").click(function(){ $("div").animate({width:"500px"}, 1500); $("div").animate({height:"400px"}, 1500); $("div").animate({width:"100px"}, 1500); $("div").animate({height:"100px"}, 1500); }); $("#btn2").click(function(){ $("div").stop(true); }); }); </script> <style> div { position: relative; height: 100px; width: 100px; margin: 10px 0; background: coral; } </style> </head> <body> <button id="btn1">开始</button> <button id="btn2">停止</button> <div></div> </body> </html>
运行结果