Skip to content

Instantly share code, notes, and snippets.

View humana-fragilitas's full-sized avatar
👓
Studying

Andrea Blasio humana-fragilitas

👓
Studying
View GitHub Profile
/**
* Problem: an Hammer.JS instance listens to the horizontal swipe gestures
* targeted at a top-level html element (e.g.: body) in order to show/hide
* an off-canvas menu; it should be possible to browse a touch-enabled carousel
* placed in the same page (e.g.: RoyalSlider, Owl Carousel or similar) without
* interfering with the above listener.
*
* Solution: enable Hammer.JS custom DOM events and prevent any "swipe" gesture
* from bubbling up to the body element by stopping event propagation via listeners
* attached to each nested touch-enabled element (e.g.: the carousel)