首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:jQuery 教程
TRY RUN / 在线示例
jQuery 教程 marginBottom
jQuery 教程 marginBottom
源代码
运行
<!DOCTYPE html> <html> <head> <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $("#p1").animate({marginBottom:"+=100px"}); }); $(".btn2").click(function(){ $("#p1").animate({marginBottom:"-=100px"}); }); }); </script> </head> <body> <button class="btn1">Animate +</button> <button class="btn2">Animate -</button> <p>This is a paragraph.</p> <p id="p1" style="border:1px solid blue;">This is an animated paragraph.</p> <p>This is a paragraph.</p> </body> </html>
运行结果