Raibaz
Raibaz

Reputation: 9700

Hammer.js swipe events not being triggered on Safari iOS

I'm trying to add swipe gestures to an image carousel, but I'm having issues with Safari on iOS.

My hammer.js initialization looks like this:

this.mc = new Hammer.Manager(this.$carousel[0]);
this.mc.add(new Hammer.Swipe({
    direction: Hammer.DIRECTION_HORIZONTAL,
    threshold: 0
}));

Where this.$carousel[0] is the div containing all the images, and the event binding is set like this:

this.mc.on('swipeleft', this.slideLeft.bind(this));
this.mc.on('swiperight', this.slideRight.bind(this));

However, this.slideLeft and this.slideRight never get called.

The weird thing is that the same code seems to be working ok on Chrome on different Android versions, and it fails to trigger the swipe* events only on Safari on iPhones.

Any ideas about what I may be missing?

Upvotes: 3

Views: 1198

Answers (1)

Raibaz
Raibaz

Reputation: 9700

Turns out there was a bug in version 2.0.1, the one I was using, where some of the events composing a swipe event were being fired in the wrong order; with version 2.0.6 it seems to be working as expected.

Upvotes: 1

Related Questions