The plugin posted in here:
http://www.tutcity.com/javascript/jquery-mousehold-event.27019.htm
is a JQuery plugin meant to listen for mousehold events.
The problem I am having is that when you do something like:
var value = 0;
$(div1).mousehold(function() {
value+=1;
$('#result').html(value);
});
The value increments and did its thing. But if for one moment you started to move your mouse to another element (I do have an event listener for mousemove as well for div1), the mousehold event is cancelled.
How can I make it that the mousehold event does not get canceled on mouseout? Thanks and I apologize if the question is kind of a novice-level if it is xD
That’s how the plugin is set up. Comment out this line:
Then it should only stop the timer on
mouseup.But now you have the problem that
mouseupwon’t fire outside of the element, so your function will keep running when you move the pointer elsewhere. To fix that you’ll have to listen formouseupevents on the whole document instead.