Created
December 20, 2012 10:01
-
-
Save gaelbillon/4344325 to your computer and use it in GitHub Desktop.
Jquery toggle cheat
Key combination to show/hide a div
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
// Press "right arrow" -> "down arrow" -> "lowercase o" to show hide a div | |
$('body').bind('keydown', function(e) { | |
if (typeof(keyPressed) == "undefined") { | |
keyPressed = []; | |
} | |
var code = (e.keyCode ? e.keyCode : e.which); | |
keyPressed.push(code); | |
if (keyPressed.length === 3) { | |
if (keyPressed[0] === 39 && keyPressed[1] === 40 && keyPressed[2] === 79) { | |
$('#bloc_users').toggle() | |
keyPressed = []; | |
} | |
else { | |
keyPressed = []; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment