문제

I can't make this code run with Android 2.x

$('body').animate({scrollLeft:50});

It's working fine with 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+:

CSS:

body{
    position:relative;
}

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 ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top