Created
December 10, 2013 12:38
-
-
Save icodesido/7889958 to your computer and use it in GitHub Desktop.
Press the same keystroke twice
This file contains hidden or 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 twice_37 = 0; | |
| $(document).on('keydown', function( e ){ | |
| var key = e.which; | |
| if(key==37){ | |
| twice_37 += 1; // almost :) | |
| if(twice_37==2){ | |
| alert('Do something! you pressed twice left!'); | |
| } | |
| setTimeout(function(){ | |
| twice_37 = 0; // Reset | |
| }, 1000); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment