Skip to content

Commit

Permalink
impressive touch support
Browse files Browse the repository at this point in the history
  • Loading branch information
bartaz committed Feb 15, 2012
1 parent cfe6448 commit db5857a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/impress.js
Expand Up @@ -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);

0 comments on commit db5857a

Please sign in to comment.