Skip to content

Instantly share code, notes, and snippets.

@MrFlick
Created May 23, 2016 21:37
Show Gist options
  • Save MrFlick/c675fbfb2745ea1ab4f95c195ed73389 to your computer and use it in GitHub Desktop.
Save MrFlick/c675fbfb2745ea1ab4f95c195ed73389 to your computer and use it in GitHub Desktop.
Trigger Next/Prev links with arrow keys
// Here You can type your custom JavaScript...
//for use with "Custom Javascript for Websites" chrome extension
//adds arrow key navigation for next/prev links
$(document).keyup(function(event) {
if (event.which==39) {
//right
var nextLink = $('a').filter(function(index) { return $(this).text() === "next"; });
window.location.href = nextLink.attr("href")
}
if (event.which==37) {
//left
var prevLink = $('a').filter(function(index) { return $(this).text() === "prev"; });
window.location.href = prevLink.attr("href")
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment