Skip to content

Commit

Permalink
Add left/right arrow keys to goto prev/next months on calendar page
Browse files Browse the repository at this point in the history
  • Loading branch information
kainoaw committed Jun 5, 2024
1 parent 7dcac93 commit 0fae541
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ function initButtons() {

// RESIZE WINDOW FOR RESPONSIVENESS
window.addEventListener('resize', windowWidth);

// ADD LEFT/RIGHT ARROWS TO GOTO PREV/NEXT MONTHS
window.addEventListener('keydown', function(event) {
if (event.key === "ArrowLeft") {
prev();
} else if (event.key === "ArrowRight") {
next();
}
});
}

/**
Expand Down

0 comments on commit 0fae541

Please sign in to comment.