为什么点击按钮“左移”“右移”之后,第二次就没有效果了呢
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>
<link href="style.css" rel="stylesheet" type="text/css"/>
<title>jQuery动画特效</title>
</head>
<body>
<button id="btn1">左移</button>
<button id="btn2">右移</button>
<div>77</div>
<script type="text/javascript">
$("div").css({"position":"absolute"});
$("#btn1").bind("click",function(){
$("div").animate({right: "+50px"},3000);
})
$("#btn2").bind("click",function(){
$("div").animate({left:"+50px"},3000);
})
</script>
</body>
</html>