Skip to content

Instantly share code, notes, and snippets.

@fronx
Forked from tsenart/gist:902681
Created April 4, 2011 23:16
Show Gist options
  • Save fronx/902682 to your computer and use it in GitHub Desktop.
Save fronx/902682 to your computer and use it in GitHub Desktop.
document.body.addEventListener('keydown', function(e) {
([37, 39].indexOf(e.keyCode) > -1) && pres[{37:'prev',39:'next'}[e.keyCode]]();
});
// VERSUS
document.body.addEventListener('keydown', function(e) {
switch(e.keyCode) {
case 37: pres.prev(); break;
case 39: pres.next(); break;
default: break;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment