Skip to content

Instantly share code, notes, and snippets.

@lmeyer
Created November 21, 2012 23:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmeyer/4128538 to your computer and use it in GitHub Desktop.
Save lmeyer/4128538 to your computer and use it in GitHub Desktop.
Mouse click and hold event
var intervalId;
var i = 0;
$("#element").mousedown(function(e) {
intervalId = setInterval(function(){
console.log(i++);
}, 10);
}).mouseup(function() {
clearInterval(intervalId);
i = 0;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment