Created
September 7, 2012 13:33
-
-
Save philhawksworth/3666283 to your computer and use it in GitHub Desktop.
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
control = { | |
32 : go_up, | |
46 : go_down | |
}; | |
$(document).bind("keydown", function(e) { | |
console.log("keydown: ", e.keyCode); | |
if(!control[e.keyCode]) { | |
return; | |
} | |
control[e.keyCode].call(); | |
}); | |
function go_up() { | |
alert("UP"); | |
} | |
function go_down() { | |
alert("DOWN"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment