Created
May 7, 2015 03:46
-
-
Save hongkheng/fc6129175d4f7ab7edec to your computer and use it in GitHub Desktop.
Long press 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
var timeoutId = 0; | |
$('#myElement').mousedown(function() { | |
timeoutId = setTimeout(myFunction, 1000); | |
}).bind('mouseup mouseleave', function() { | |
clearTimeout(timeoutId); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment