Last active
August 29, 2015 13:58
-
-
Save thomaskimura/10341757 to your computer and use it in GitHub Desktop.
Finally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
//KEYBOARD NAVIGATION FOR PERMALINK | |
document.body.onkeydown = function(e){ | |
if (e == null) { | |
keycode = event.keyCode; | |
} else { | |
keycode = e.which; | |
} | |
if(keycode == 39){ | |
$('#sb-site').addClass( "leftAnimate" ); //this class will animate the element to the left | |
setTimeout(function(){ | |
window.location = $('#nextPost').attr('href'); | |
},300); | |
} else if(keycode == 37){ | |
$('#sb-site').addClass( "rightAnimate" ); /this class will animate the element to the right | |
setTimeout(function(){ | |
window.location = $('#previousPost').attr('href'); | |
},300); | |
} | |
else if(keycode == 191){ | |
$("#sb-site").addClass( "fadeAnimate" ); | |
setTimeout(function(){ | |
window.location = $('#random').attr('href'); | |
},300); | |
} | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment