Skip to content

Instantly share code, notes, and snippets.

View wiesys's full-sized avatar

Viesturs Knopkens wiesys

View GitHub Profile
@wiesys
wiesys / swipe.js
Last active March 9, 2021 03:12 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.changedTouches[0].pageX;
touchstartY = event.changedTouches[0].pageY;