0

I'm having an issue with Hammerjs swipe gestures breaking scrolling on my page. If I enable hammer on my main container with a swipe it breaks the scrolling on iOS devices. However the swipe even does go through and calls the proper function.

Anyone else encountered an issue like this? The tips n tricks section on their site says to avoid vertical swiping and panning but I just wanted to see if there were any workarounds.

1

1 Answer 1

1

When I tried this

var myElement = document;

// create a simple instance
// by default, it only adds horizontal recognizers
var mc = new Hammer(myElement);

// let the pan gesture support all directions.
// this will block the vertical scrolling on a touch-device while on the element
mc.get('swipe').set({ direction: Hammer.DIRECTION_ALL });

// listen to events...
mc.on("swipedown swipeleft swipeup swiperight tap press", function(ev) {
    console.log(ev.type +" gesture detected.");
});

Even the comments say,

this will block the vertical scrolling on a touch-device while on the element

Basically, if you take over the events for vertical swipe, it takes away vertical scrolling on the given element... which in my case is "document", thus disabling scrolling completely... -_-

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.