I have a parent and child div. Panning/dragging on the child should not affect the parent. This is a similar question but was asked a year ago, and I'm using a newer version of Hammer.js w/ the jQuery wrapper.
My assumption was that I'd have to somehow stopPropagation() but I'm not really sure how to use it.
I've mocked up a demo showing my problem on JsFiddle. I've also commented out the couple things I've tried.
$(".outer-box").hammer().bind("panright", function(event){
// do stuff when panning
// panning here should move both boxes
});
$(".outer-box").hammer().bind("panend", function(event){
// do stuff when panning ends
});
$(".inner-box").hammer().bind("panright", function(event){
// do stuff when panning
// panning here should only affect the inner box
});
$(".inner-box").hammer().bind("panend", function(event){
// do stuff when panning ends
});
Any suggestions or tips? Thanks!
stopImmediatePropagation
worked for me, when juststopPropagation
was not. Thank you! – Schuh