Skip to content

Commit

Permalink
Only act on press on left click
Browse files Browse the repository at this point in the history
  • Loading branch information
alex391 committed May 30, 2024
1 parent 9ad2d8d commit 64388e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// Act on press
const links = document.querySelectorAll("a");
for (const link of links) {
link.addEventListener("mousedown", () => {
window.location = link.href;
link.addEventListener("mousedown", (event) => {
if (event.button == 0) { // Only for left clicks
window.location = link.href;
}
});
}

0 comments on commit 64388e2

Please sign in to comment.