下面是实际滑动 div 的代码,从右向左滑动工作正常,但是当我从左向右滑动时。它给了一些震动。因为
<div style="overflow:hidden;height:100px;width:100px;overflow:hidden;">
<div class="cont" style="position:relative;width:205px;left:0px;top:0px">
<div class="x" id="x_1" style="float:left;width:100px;height:100px;background-color:red;"></div>
<div class="x" id="x_2" style="float:left;width:100px;height:100px;background-color:blue;"></div>
</div>
</div>
<input type="button" value="clik me1" data-info="1" id="click1"/>
<input type="button" value="clik me2" data-info="2" id="click2"/>
<script>
$("#click1,#click2").bind('click',function(){
var id = $(this).data("info");
if(id == 2) {
$(".cont").animate({left:'-100px'},500,'linear');
} else {
$(".cont").animate({left:'0px'},4000,'linear');
//above line actually not animating from -100px to 0px , its animating to -100px to -109px and then its animating to 0px. I want to know why its happening.
}
});
</script>
在下面的网址中,您可以找到脚本
我的 chrome 浏览器有问题。它不是一个有效的错误 http://jsbin.com/ukakah/2/edit