Created
June 5, 2015 22:17
-
-
Save nickiaconis/0058589d2d901c858b84 to your computer and use it in GitHub Desktop.
Keyboard Navigation for Ember.js Guide pages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document.body).on('keyup', function(event) { | |
var linkClass; | |
switch(event.which) { | |
case 37: // left arrow | |
linkClass = '.previous-guide'; | |
break; | |
case 39: // right arrow | |
linkClass = '.next-guide'; | |
break; | |
default: | |
return; | |
} | |
window.location.assign && window.location.assign($(linkClass).attr('href')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment