Open Robzhavas opened 6 years ago
Can you show more of your code?
I had this issue too, but managed to fix using:
var element = document.querySelector('.swipe-this');
var manager = new Hammer.Manager(element);
var Swipe = new Hammer.Swipe({
direction: 6
});
manager.add(Swipe);
manager.on('swipeleft', function (e) {
// do something when swipe left
});
manager.on('swiperight', function (e) {
// do something when swipe right
});
The direction
property, as you can imagine, limits the swipe direction.
6
= DIRECTION_HORIZONTAL - Reference.
The config must be set to direction: 6. In vue I would do
import { VueHammer } from 'vue2-hammer';
import Vue from 'vue';
VueHammer.config.swipe = {
direction: 6
};
Vue.use(VueHammer);
Thanks ericgruby01 for letting me know about the numbers for the constants.
i added hammer.js to detect the swiping direction, I user only the left and right detectors "direction == 'right', direction == 'left' ". Its working fine but when you swipe up and down on mobile, it doenst scroll anymore. (if your finger is on the div where i'm using hammer.js). How can i make it stop conflicting ?