<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jQuery动画特效</title> <style> #div1{width:100px;height:100px;background:red;left:100px;position:relative;} </style> <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script> </head> <body> <input type="button" value="左移" id="btn1"> <input type="button" value="右移" id="btn2"> <div id="div1"></div> <script> $(function(){ $("#btn1").bind("click",function(){ $("div1").animate({left:"-=50px"},1000); }) $("#btn2").bind("click",function(){ $("div1").animate({left:'+=50px'},1000); }) }) </script> </body></html>
1 回答
- 1 回答
- 0 关注
- 1524 浏览
添加回答
举报
0/150
提交
取消