Skip to content

Commit

Permalink
🚸 Improve mobile navigation
Browse files Browse the repository at this point in the history
Fix #4
  • Loading branch information
nwingt committed Aug 17, 2024
1 parent c3847f7 commit 2759cb0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,19 @@ useEventListener("keydown", (event) => {
break;
}
});
useEventListener(renditionEl.value, "click", (event) => {
if ('ontouchstart' in window && renditionEl.value) {
const width = renditionEl.value.clientWidth;
const x = event.clientX % width;
const threshold = 0.3;
const side = width * threshold;
if (x < side) {
prevPage();
} else if (width - x < side) {
nextPage();
}
}
});
</script>

0 comments on commit 2759cb0

Please sign in to comment.