3 ms·
Wow, really? I didn't realize you could swipe in this presentation. Looks like this was all it took to implement? var addTouchListeners = function() { do
by audionerd 16y ago
Wow, really? I didn't realize you could swipe in this presentation. Looks like this was all it took to implement?
var addTouchListeners = function() {
document.addEventListener('touchstart', function(e) {
touchStartX = e.touches[0].pageX;
}, false);
document.addEventListener('touchend', function(e) {
var pixelsMoved = touchStartX - e.changedTouches[0].pageX;
var SWIPE_SIZE = 150;
if (pixelsMoved > SWIPE_SIZE) {
nextSlide();
}
else if (pixelsMoved < -SWIPE_SIZE) {
prevSlide();
}
}, false);
};