编辑下面的代码:【加编码】
<html> <head> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $(".btn1").click(function(){ $("body").animate({ backgroundPositionX:"+=100px", backgroundPositionY:"+=200px" }); }); $(".btn2").click(function(){ $("body").animate({ backgroundPositionX:"0px", backgroundPositionY:"0px" }); }); }); </script> </head> <body style="background-image:url(/static/images/w3jquery.gif);background-repeat:no-repeat;position:fixed;"> <button class="btn1">Animate</button> <button class="btn2">Reset</button> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂