实现功能:

1、当点击按钮的时,移动页面上的某个元素

Jquery代码:

 

<script type="text/javascript">

$(document).ready(function(){

  $(".btn1").click(function(){

    $("#box").animate({left:"-=100px"});

  });

  $(".btn2").click(function(){

    $("#box").animate({left:"+=100px"});

  });

});

</script>

HTML代码:

<body>

<div id="box" style="position:absolute; left:1px;top:40px; background:#98bf21;height:100px;width:1000px;margin:6px;">

</div>

<button class="btn1">Animate</button>

<button class="btn2">Reset</button>

</body>

 

 

-----上传了源文件,有需要的自己下载下来看看吧!