移动的问题?
<!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>
<title>jQuery动画特效</title>
<style type="text/css">
div{
width:40px;
height:40px;
margin:10px;
left:100px;
border:2px solid;
background:blue;
position:absolute;
}
</style>
</head>
<body>
<input type="button" value="左移" id="left"/>
<input type="button" value="右移" id="right"/>
<div></div>
<span></span>
<script type="text/javascript">
$(function(){
$("#left").bind("click",function(){
$("div").animate({
left:"+=50"
},3000)
});
$("#right").bind("click",function(){
$("div").animate({
left:"-=50"
},3000)
});
})
</script>
</body>
</html>
在
$("#right").bind("click",function(){
$("div").animate({
left:"-=50"
},3000)
中为什么把“left”改成“right”右移的效果就没有了呢?求解答?谢谢!