Skip to content

Commit

Permalink
feat: fix swipe dir?
Browse files Browse the repository at this point in the history
  • Loading branch information
EliezerIsrael committed Sep 10, 2024
1 parent 9a5c723 commit eb50634
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions swiper.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<div id="topic1" class="topic current"></div>
<div id="topic2" class="topic next"></div>
<div id="instructions">
Swipe left/right or use arrow keys
Swipe right for new topic, left for Sefaria. Use arrow keys for the same.
</div>
</div>

Expand Down Expand Up @@ -210,9 +210,9 @@
app.addEventListener('touchend', (e) => {
if (Math.abs(distX) > 50) { // Minimum swipe distance
if (distX > 0) {
navigateToSefaria();
swapTopics(); // Right swipe (LTR) loads new topic
} else {
swapTopics();
navigateToSefaria(); // Left swipe (RTL) navigates to Sefaria
}
}
startX = 0;
Expand All @@ -222,9 +222,9 @@
// Keyboard support
document.addEventListener('keydown', (event) => {
if (event.key === 'ArrowLeft') {
swapTopics();
swapTopics(); // Left arrow now loads new topic
} else if (event.key === 'ArrowRight') {
navigateToSefaria();
navigateToSefaria(); // Right arrow now navigates to Sefaria
}
});

Expand Down

0 comments on commit eb50634

Please sign in to comment.