discussion, gear, and photography journal


B and H B andH
Monday, 17 March 2008
As a regular user of Google Reader (Google's web-based RSS reader), I've become used to the keyboard shortcuts it supports to speed up navigation.
(If you use Google Reader, and were not aware of the keyboard shortcuts, hit "shift-?" in Google Reader to view the complete list of valid shortcuts.)

I decided to implement something similar in my photo gallery, to allow keyboard shortcuts to be used to navigate through all photos in a gallery.

Some quick Googling turned up plenty of sample javascript code for implementing this functionality. I ended up using sample code from a page titled Handling Keyboard Shortcuts in JavaScript.

After a bit of coding, my photo gallery now supports the following keyboard shortcuts when viewing the contents of a gallery:

j    next image
k    previous image
shift-j    next page
shift-k    previous page

These use of the j and k shortcut keys is similar to that in Google Reader, and is very familiar to me, as j and k are used in vi (a linux text editor) for moving to the next and previous lines.
If you enjoyed this post, then subscribe to my RSS feed,
or subscribe by email to get updates directly in your inbox.
Leave a comment:
Name:
Email address (required):  (will not be published)
URL (optional):
Comments
(no HTML allowed,
some BBcode allowed):
  
Note that comments are moderated, and will not appear immediately.
get your advert here
martybugs.net