I use iScroll.js to scroll the items carousel on the mobile page. I found the following fix that listens for vertical movement and stops iScroll script control, allowing me to execute my own vertical scroll:
onBeforeScrollStart: function(e) { try { point = e.touches[0]; pointStartX = point.pageX; pointStartY = point.pageY; } catch(e) {} null; }, onBeforeScrollMove: function(e) { try { deltaX = Math.abs(point.pageX - pointStartX); deltaY = Math.abs(point.pageY - pointStartY); if (deltaX >= deltaY) { e.preventDefault(); } else { null; } } catch(e) {} }
I use try {} catch {}, because it had some problems when testing in the browser (complained that the point was not defined).
The problem I am facing is that it works well on iOS, has been tested on multiple i-devices, but on Android it is not so good. If the user tries to scroll the page vertically, starting with placing a finger on the carousel, the page does not scroll, since iScroll still has control.
Any idea how I can make it work on Android, or any pointers to where this might go wrong?
Edit:
Some debugging, and I discovered why this is not working. The coordinates are updated when the user touches the screen on iOS, but on Android only the first set of coordinates is captured. Any idea why this would be?
Don h
source share