Skip to content

Instantly share code, notes, and snippets.

@gaelbillon
Created December 20, 2012 10:01
Show Gist options
  • Save gaelbillon/4344325 to your computer and use it in GitHub Desktop.
Save gaelbillon/4344325 to your computer and use it in GitHub Desktop.
Jquery toggle cheat Key combination to show/hide a div
// 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