Created
April 23, 2013 22:10
-
-
Save SgtPooki/5447849 to your computer and use it in GitHub Desktop.
Simple function to create an object with list of currently pressed keys
This file contains 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
var keys = {}; | |
$('#notes') | |
.live('keydown', function(e){ | |
keys[e.keyCode] = 'down'; | |
console.log(keys); | |
}) | |
.live('keyup', function(e){ | |
delete keys[e.keyCode]; | |
console.log(keys); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment