stephband / jquery.event.swipe

jQuery custom events swipeleft, swiperight, swipeup and swipedown
stephband.info/jquery.event.swipe
446 stars 180 forks source link

Plugin prevents scroll webpage normally on mobile. #32

Closed kotelesroberto closed 9 years ago

kotelesroberto commented 9 years ago

After calling hte function with $('body').on('swipeleft', function(e) { .... }); and also with $('body').on('swiperight', function(e) { .... }); on mobile is not possible to scroll the webpage up/down as a normal webpage. It still frozen and only works to left and right. But not possible to use the page normally. Because the webpage where I'm using this plugin needs to scroll down to read the content it's weird.

My phone is Samsung Galaxy SIII (i9300) and browser is Chrome.

kotelesroberto commented 9 years ago

It helped, thanks:

$('body').on('movestart', function(e) { // If the movestart is heading off in an upwards or downwards // direction, prevent it so that the browser scrolls normally. if ((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) { e.preventDefault(); } });