Skip to content

Instantly share code, notes, and snippets.

@A-limon
Forked from pala/navigation.js
Created March 16, 2013 14:27
$(function(){
$(document).keydown(function(e) {
var url = false;
if (e.which == 37 || e.which == 74) { // Left arrow and J
{% if page.previous %}
url = '{{page.previous.url}}';
{% endif %}
}
else if (e.which == 39 || e.which == 75) { // Right arrow and K
{% if page.next %}
url = '{{page.next.url}}';
{% endif %}
}
if (url) {
window.location = url;
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment