stephband / jquery.event.swipe

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

Doesn't allow page scrolling on mobile device when listener attached to body #17

Closed lakario closed 10 years ago

lakario commented 10 years ago

This library breaks page level scrolling on a mobile device when a swipe event is attached to the body (or window). It works fine on a desktop browser.

$(document).ready(function() {
    $('body').on('swiperight', function() {
        alert('swiperight');
    }).on('swipeleft', function() {
        alert('swipeleft');
    });
});

Example: http://www.nathantaylor.com/swipe.html

danielmsong commented 10 years ago

@lakario, not sure if this will fix your problem, but you're missing the event argument on those callback functions:

 $('body').on('swiperight', function(e) {
sfblaauw commented 10 years ago

Same to me, any idea?

stephband commented 10 years ago

Have you read the bit about detecting horizontal or vertical scroll and disabling one or the other? - http://stephband.info/jquery.event.swipe/#scroll