Skip to content

Instantly share code, notes, and snippets.

@dovy
Created August 11, 2015 05:22
Show Gist options
  • Save dovy/57766c892e014082950a to your computer and use it in GitHub Desktop.
Save dovy/57766c892e014082950a to your computer and use it in GitHub Desktop.
This jQuery snipper allows you to make any key combo you want, via codes. Just grab the key codes here: http://keycodes.atjayjo.com/
var map = {87: false, 83: false}; // Update checked keys
$( document ).keydown( function( e ) {
if ( e.keyCode in map ) {
map[e.keyCode] = true;
if ( map[87] && map[83] ) { // update checking of keys
console.log('here'); // Action goes here
}
}
}).keyup(function(e) {
if ( e.keyCode in map ) {
map[e.keyCode] = false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment