i use this code, to scroll overflow div (hidden) in ipad , and works expect its not smooth , is there any way i can make it smooth scroll ?
function initMobileScroll(ele) {
var mobileScrollArea = document.getElementById(ele);
mobileScrollArea.addEventListener('touchstart', function(event){
touchstart (event);
});
mobileScrollArea.addEventListener('touchmove', function(event){
touchmove (event);
});
// let’s set the starting point when someone first touches
function touchstart (e) {
startY = e.touches[0].pageY;
startX = e.touches[0].pageX;
}
// calls repeatedly while the user’s finger is moving
function touchmove(e) {
var touches = e.touches[0];
// override the touch event’s normal functionality
e.preventDefault();
// y-axis
var touchMovedY = startY - touches.pageY;
startY = touches.pageY; // reset startY for the next call
mobileScrollArea.scrollTop = mobileScrollArea.scrollTop + touchMovedY;
// x-axis
var touchMovedX = startX - touches.pageX;
startX = touches.pageX; // reset startX for the next call
mobileScrollArea.scrollLeft = mobileScrollArea.scrollLeft + touchMovedX;
}
}
code source : http://www.flexmls.com/developers/2011/04/13/ipad-and-single-finger-scrolling-in-flexmls/
add this to your css:
-webkit-overflow-scrolling: touch;
Safari: iOS 5
Android Browser: 3.0
Blackberry Browser: 6
Chrome for Mobile
Firefox Mobile
IE Mobile: 9
Opera Mobile
example: JSfiddle
reference: barrow.io - Overflow scrolling
Take a look at this: http://cubiq.org/iscroll-4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With