Created
February 8, 2013 15:22
-
-
Save bwsewell/4739667 to your computer and use it in GitHub Desktop.
Capturing a double keystroke with jQuery
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
// Will fire an alert if user presses the "F" key twice within 300 miliseconds | |
var dblCtrlKey = 0; | |
$(document).keydown(function(e) { | |
if (dblCtrlKey != 0 && e.which == 70) { | |
alert("Ok double F"); | |
} else { | |
dblCtrlKey = setTimeout('dblCtrlKey = 0;', 300); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment