Skip to content

Commit

Permalink
fix decoding of arrow key events
Browse files Browse the repository at this point in the history
  • Loading branch information
WardCunningham committed Nov 3, 2024
1 parent 38fb39b commit b247a99
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,9 @@ $(function() {

const LEFTARROW = 37;
const RIGHTARROW = 39;
const dirs = {LEFTARROW:-1, RIGHTARROW:+1};

$(document).on("keydown", function(event) {
const direction = dirs[event.which];
const direction = event.which == LEFTARROW ? -1 : event.which == RIGHTARROW ? 1 : null
if (direction && !$(event.target).is(":input")) {
const pages = $('.page');
const newIndex = pages.index($('.active')) + direction;
Expand Down

0 comments on commit b247a99

Please sign in to comment.