enhancement: Add the position where you started to slide to the returned events
AEROGU opened this issue · comments
Arturo Rosas commented
Sometimes you need to know where the user started to swipe (and where have they finished it), for example, to display a menu if they swipe from the left half of the screen of their device.
It would be great if this data was added to the event that is passed to the functions, in order to use it.
John Doherty commented
Thank you for the suggestion @AEROGU. I added this feature in a more standards compliant way using event.detail property:
document.addEventListener('swiped-left', function(e) {
console.log(e.target); // element that was swiped
console.log(e.detail); // event data { dir: 'left', xStart: 196, xEnd: 230, yStart: 196, yEnd: 4 }
});