Last active
August 29, 2015 14:00
-
-
Save WillsonSmith/6226d724098f2d63908d 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
(function(){ | |
'use strict'; | |
var c = document.getElementById('container'); | |
var start, | |
move, | |
end; | |
c.addEventListener('touchstart', function(e){ | |
start = e.pageX; | |
}, false); | |
c.addEventListener('touchmove', function(e){ | |
move = e.pageX; | |
}, false); | |
c.addEventListener('touchend', function(e){ | |
end = move; | |
if (start > end){ | |
console.log('swipe left'); | |
} | |
if (start < end){ | |
console.log('swipe right'); | |
} | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment