jQuery的scrollLeft不工作在Android [英] jquery scrollLeft not working on Android
问题描述
在code以下无法正常工作在Android浏览器!
如何解决呢?
<输入ID =sannn类型=按钮值=SAN/>
< DIV ID =sann的风格=宽度:640px;高度:200像素;溢出:滚动;边界:固体1px的红色;>
< DIV的风格=边界:1px的固体绿色;宽度:3000px;高度:200像素;> 4545< / DIV>
< / DIV>
$('#sannn)。绑定(点击,函数(){
$('#sann')scrollLeft(10)。
});
看起来它是Android的浏览器中的错误4.0.3 +
的http://$c$c.google.com/p/android/issues/detail?id=38505&thanks=38505&ts=1350315570
问题38505:DOM元素scrollLeft制定者不能在Android浏览器工作4.0.3 +
放置DIV包装作为相对具有溢出隐藏和特定的宽度和高度。使用绝对位置的内格(股利要移动),并通过jQuery的内嵌式的左侧位置播放。
如果你真的需要滚动条。在jQuery UI的滑块可能会有所帮助: http://jqueryui.com/slider/
The code below is not working in Android browser!
How do I fix it?
<input id="sannn" type="button" value="SAN" />
<div id="sann" style="width:640px; height:200px; overflow:scroll; border:solid 1px red;">
<div style="border:solid 1px green; width:3000px; height:200px;">4545</div>
</div>
$('#sannn').bind('click', function () {
$('#sann').scrollLeft(10);
});
Looks like it is a bug in Android Browsers 4.0.3+
http://code.google.com/p/android/issues/detail?id=38505&thanks=38505&ts=1350315570
Issue 38505: DOM element scrollLeft setter doesn't work in Android Browser 4.0.3+
Position the div wrapper as relative with overflow hidden and a specific width and height. Use position absolute on the inner div (the div you want to move) and play with the inline style left position via jQuery.
If you really need scrollbars. The Jquery UI sliders might help: http://jqueryui.com/slider/
这篇关于jQuery的scrollLeft不工作在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!