Question

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?

Was it helpful?

Solution

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+
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top