impressive touch support

This commit is contained in:
Bartek Szopka
2012-02-15 20:39:45 +01:00
parent cfe6448594
commit db5857afda

View File

@@ -382,5 +382,23 @@
}
}, false);
// touch handler to detect taps on the left and right side of the screen
document.addEventListener("touchstart", function ( event ) {
if (event.touches.length === 1) {
var x = event.touches[0].clientX,
width = window.innerWidth * 0.3,
result = null;
if ( x < width ) {
result = impress().prev();
} else if ( x > window.innerWidth - width ) {
result = impress().next();
}
if (result) {
event.preventDefault();
}
}
}, false);
})(document, window);