[英]body scrollLeft with Android 2.x
I can't make this code run with Android 2.x 我无法使此代码在Android 2.x上运行
$('body').animate({scrollLeft:50});
It's working fine with Android 3/4. 在Android 3/4上运行正常。
Have your ever met this issue? 您遇到过这个问题吗? If so, did you find a workaround? 如果是这样,您找到了解决方法吗?
I finally found a solution ; 我终于找到了解决方案; I use Cordova to detect the Android version, as the workaround does not seem to be compatible with Android 3+: 我使用Cordova来检测Android版本,因为解决方法似乎与Android 3+不兼容:
CSS: CSS:
body{
position:relative;
}
jQuery: jQuery的:
var deviceVersion = device.version.charAt(0);
if (deviceVersion == "2"){
$('body').animate({left:-50}); // ANDROID 2
}else{
$('body').animate({scrollLeft:-50}); // ANDROID 3+
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.