Skip to content

Instantly share code, notes, and snippets.

@lmeyer
Created November 21, 2012 23:31
Show Gist options
  • 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