Open justinshea opened 10 years ago
Yeah I had a hard time figuring out this and actually I couldn't get simple jQuery
delegation to work properly, like:
$ul.on('tap', 'li', doStuff);
But if you do the following apparently it will prevent the tap in the outer box:
$('.innerBox').hammer({domEvents: true}).on("tap", function(e){
e.gesture.stopPropagation();
});
Thanks for the feedback. I tried adding the "domEvents" option but that still doesn't work (btw -where is the documentation on this option? I cant find it anywhere).
I Think this is a bug..the preventDefault and stopPropagation methods are simply unavailable within the gesture object and, using the method from the top-level of the jquery event is not recognized by hammer.
FYI, I came across this: https://github.com/josdejong/propagating-hammerjs I am about to try it
Quick update - I can't seem to get the above package working on Meteor as it's NPM and it would have to be server side. So no luck. and I have the issue with my "press" events are still propagating up the DOM tree. Any help appreciated.
FYI @justinshea @mciparelli - I got this working with https://github.com/josdejong/propagating-hammerjs as per https://github.com/josdejong/propagating-hammerjs/issues/1
With no disrespect for @josdejong 's good work it would be nice if this just worked out of the box (pretty please)
See also https://github.com/hammerjs/hammer.js/issues/652
Yeah, event propagation is quite a corner stone of event handling in the browser. It's too bad that hammer.js doesn't (yet?) support this.
hi guys, do you have plan to fix it?
Hi, I recently updated to most recent hammer.js and jquery.hammer.js . I was previously using jquery.hammer-full.js. There seem to be some major changes in usage that I am just feeling out. One significant change seems to be that there are no more methods in event.gesture like "stopPropagation" and "stopDetect" -- calling these will now return "undefined". Seeing this I thought I could use "stopPropagation" method in the top level event in order to stop a touch event from bubbling up the DOM like I would for any "standard" event. However, this doesn't seem to work: http://jsfiddle.net/justinshea/4tL6xub1/ In the example you will notice that tapping on the innerbox will bubble to outerbox even though stopPropagation is called for tap event in innerbox..Not sure if this is an "issue" or if I am just missing something??? any/all feedback is appreciated... Thanks, Justin