W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".btn1").click(function(){ $("p").animate({height:"50%"}); }); $(".btn2").click(function(){ $("p").animate({height:"20px"}); }); }); </script> </head> <body> <p style="background-color:yellow;height:20px;">This is a paragraph.</p> <button class="btn1">Animate</button> <button class="btn2">Reset</button> </body> </html>