Skip to content

Instantly share code, notes, and snippets.

@vankasteelj
Created April 11, 2020 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vankasteelj/2aea6401dc9bca8a8f169ee8b11265c9 to your computer and use it in GitHub Desktop.
Save vankasteelj/2aea6401dc9bca8a8f169ee8b11265c9 to your computer and use it in GitHub Desktop.
Jquery click & hold
var timeOut = 0;
$('.button').on('mousedown', function(e) {
console.log('click');
//start hold
var i = 0;
timeOut = setInterval(function(){
console.log('hold for', i++);
}, 150);
}).bind('mouseup mouseleave', function(e) {
clearInterval(timeOut);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment