Created
December 30, 2019 12:51
-
-
Save HashandSalt/56707ddf351b8d7d111b70ea2688d6ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gestureZone.addEventListener('touchstart', function(event) { | |
touchstartX = event.changedTouches[0].screenX; | |
}, false); | |
gestureZone.addEventListener('touchend', function(event) { | |
touchendX = event.changedTouches[0].screenX; | |
handleGesture(); | |
}, false); | |
function handleGesture() { | |
if (touchendX < touchstartX && Math.abs(touchendX - touchstartX) > 150) { | |
window.location.replace(prev.href) | |
} | |
if (touchendX > touchstartX && Math.abs(touchendX - touchstartX) > 150) { | |
window.location.replace(next.href) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment