In creating a pretty unique themed wordpress site, i think it would be cool to have the ‘Left’ and ‘Right’ arrow keys to navigate from page to page (which would be next/prev post in wordpress).
I came across this tutorial on how to write the JS, but can not figure out how to incorporate it with WordPress to use make a dynamic link upon page load for the next or previous post.
This is how the code looks:
document.onkeyup = KeyCheck;
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
}
}
document.onkeyup = KeyCheck;
function KeyCheck(e)
{
var KeyID = (window.event) ? event.keyCode : e.keyCode;
switch(KeyID)
{
case 37:
window.location = "page.html"; //back
break;
case 39:
window.location = "another-page.html"; //forward
break;
}
}
Cheers guys!