Posted By

ATLChris on 08/26/10


Tagged

navigation jquery keyboard arrow keys Shortcuts


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

seloh77


Navigate Pages Using the Left/Right Keyboard Arrows


 / Published in: jQuery
 

This is just a basic example of how you would allow navigation via left/right arrow keys. This is most commonly used when navigating multiple-image image galleries.

  1. jQuery(document).keydown(function(e){
  2. if (e.which == 37) { // 37 is the left arrow key code.
  3. window.location.href = 'http://www.url.com';
  4. };
  5. if (e.which == 39) { // 39 is the right arrow key code.
  6. window.location.href = 'http://www.url.com';
  7. };
  8. });

Report this snippet  

You need to login to post a comment.