Skip to content

Instantly share code, notes, and snippets.

@scfrisby
Created July 8, 2012 21:58
Show Gist options
  • Save scfrisby/3073087 to your computer and use it in GitHub Desktop.
Save scfrisby/3073087 to your computer and use it in GitHub Desktop.
$(document).keyup(function(e) {
var url = false;
// back arrow - previous post
if (e.which == 37) { url = $('.previous').attr('href'); }
// forward arrow - next post (unless this post is the most recent one).
else if (e.which == 39) { url = $('body:not(.latest) .next').attr('href'); }
// the 'H' key takes you to the homepage.
else if (e.which == 72) { url = '../'; }
// Go
if (url) {
window.location = url;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment