I need to track user touch events. I want to track when user swipes from edges.
For example when user swipes from left vertical edge I will show a menu, from right edge
I had trouble making this work using Hammer.JS - v2.0.8 and refering to the actual documentation.
Based on 2BitNerd's answer here is what I used:
Hammer(document.body).on("swiperight", function(e) {
var endPoint = e.pointers[0].pageX;
var distance = e.distance;
var origin = endPoint - distance;
if (origin <= 15) {
// They swiped, starting from no more than 15px away from the edge.
}
});
The .gesture attribute has to be skipped for me to make this work as it does not exist.