javascripthtmlswipehammer

Hammer js nested events?


I'm trying to some kind of pattern for my web app, so if the user swipes up and left, respectively it will trigger an event

How to do that with hammer js? It seems like using recognizeWith() API but I don't quite understand the usage.


Solution

  • I was trying to do the exact same thing recently with Hammer.js but found it way more difficult than it should be. I ended up writing a library myself to do exactly this.

    https://www.npmjs.com/package/swipey.js

    The listener will fire a callback when the user does a valid swipe. The callback will receive an object with some details such as "direction", which in your case would be "up-left"