Skip to content

Instantly share code, notes, and snippets.

@mattborn
Last active December 14, 2015 09:59
Show Gist options
  • Save mattborn/5068555 to your computer and use it in GitHub Desktop.
Save mattborn/5068555 to your computer and use it in GitHub Desktop.
dotjs page navigation via arrow keys on thecodinglove.com save as ~/.js/thecodinglove.com.js + make sure your using the dotjs chrome extension
$(window).keydown(function(e){
var next = parseInt(location.pathname.split('/')[2])+1 || 2;
var prev = parseInt(location.pathname.split('/')[2])-1;
if (e.which === 39) {
document.location.href = ('/page/'+next);
} else if (e.which === 37) {
document.location.href = ('/page/'+prev);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment