运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往空间
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $("#p1").animate({paddingTop: "+=100px"}); }); $(".btn2").click(function(){ $("#p1").animate({paddingTop: "-=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>