一旦切换移动按钮后,再点击原来的就没有效果
这是为什么。下面是代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery动画特效</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
</head>
<style>
.gg{border:2px solid blue;
width:150px;height:80px;
position:relative; }
</style>
<body>
<div class="gg"></div>
<input type="button" id="aa"value="左移">
<input type="button" id="bb"value="右移">
</body>
<script>
$(function(){
$("#aa").bind("click",function(){
$("div").animate({right:"+=50px"},1000)});
$("#bb").bind("click",function(){
$("div").animate({left:"+=50px"},1000)})
} )
</script>
</html>