搜索文档
首页
HTML/CSS
JavaScript
服务端开发
Java教程
移动端
数据库
当前位置:
首页
JavaScript
jQuery 教程
jQuery 效果
源代码
清空
点击运行
<!DOCTYPE html> <html> <title>jQuery animate()动画高度变化示例 - 基础教程(div.cn)</title> <head> <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("div").animate({height: "toggle"}); }); }); </script> <style> div { height: 200px; width: 200px; margin: 10px 0; background: coral; } </style> </head> <body> <p>多次单击按钮以切换动画。</p> <button>切换高度</button> <div></div> </body> </html>
运行结果