diff --git a/docs/deck/index.html b/docs/deck/index.html
index 9a513d6907..3e85ce070f 100644
--- a/docs/deck/index.html
+++ b/docs/deck/index.html
@@ -10,28 +10,44 @@
let current = parseInt(window.location.hash.substring(1)) || 0;
window.location.hash = current;
document.addEventListener("keydown", function(event) {
- let next = current;
switch (event.key) {
case " ":
case "ArrowDown":
case "ArrowRight":
case "Enter":
- next += 1;
+ slide(current + 1);
break;
case "ArrowLeft":
case "ArrowUp":
- next -= 1;
+ slide(current - 1);
break;
}
+ });
- if (next < 0 || next + 1 > SLIDES) {
+ function slide(i) {
+ if (i < 0 || i >= SLIDES) {
return;
}
- window.location.hash = next;
+ window.location.hash = current = i;
+ }
+
+ let x;
- current = next;
+ document.addEventListener('touchstart', e => {
+ x = e.changedTouches[0].screenX;
});
+
+ document.addEventListener('touchend', e => {
+ if (e.changedTouches[0].screenX < x) {
+ slide(current + 1);
+ }
+
+ if (e.changedTouches[0].screenX > x) {
+ slide(current - 1);
+ }
+ });
+