hammerjs pan event not working in cordova app

佐手、 提交于 2019-12-13 01:48:03

问题


I'm using Hammer.js with the jQuery plugin in a Cordova app. I am also using zepto and zepto touch. The reason for having both (currently) is that I recently used only zepto. But the touch/gestures didn't work on Android. So now I try to move to Hammer.js, event by event. While the Pinch Events are working perfect (while zepto touch is also included as library), I don't get the pan event fired. Maybe there is a zepto swipe event interfering, but I wasn't able to verify this.

Here is my code:

hammerReciever = $('.slide[data-idx="' + imageIdx + '"] img').hammer({recognizers: [ [Hammer.Pinch], [Hammer.Pan, { event: 'pan', direction: Hammer.DIRECTION_ALL, threshold: 20, pointers: 1 }]]}); 
hammerReciever.on('pinchin', $.proxy(this.gestureChangeHammer, this));
hammerReciever.on('pinchout', $.proxy(this.gestureChangeHammer, this));
hammerReciever.on('pan panstart panstop panmove', console.log('panmove'));

I've tried it with treshold of 0 and 10. Also I've tried to use "pan", "pan panmove" and "panmove" in the on function.

Any idea?

来源:https://stackoverflow.com/questions/30978277/hammerjs-pan-event-not-working-in-cordova-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!