I'm using this JS library to check for a swipe up and swipe down event on a mobile device.
https://github.com/john-doherty/swiped-events/blob/master/src/swiped-events.js
When the user swipes up or swipes down, I use this to hide a div. But when they swipe, the page also starts scrolling in the direction they swiped. How do I stop the page from scrolling by canceling the scroll event? I just want to detect the swipe here and cancel the event that causes the page to scroll with momentum on mobile devices.
document.addEventListener('swiped-up', function(e) {
*prevent the page from scrolling. Just detect the swipe, but cancel the touch event that makes the page scroll*
document.getElementById("div").style.dispay = none;
});
document.addEventListener('swiped-down', function(e) {
*prevent the page from scrolling. Just detect the swipe, but cancel the touch event that makes the page scroll*
document.getElementById("div").style.dispay = none;
});