Mousehold event for jQuery.
$(elem)
.on("mousehold",
{
duration: 1000,
delay: 500,
tolerance: 0
},
function(){
console.log("User is holding the mouse button.");
});
duration (default: 1000)
The amount of time in milliseconds user should hold the mouse button until mousehold event is triggered.
delay
The amount of time in milliseconds after user presses on the mouse button until mouseholdstart event is triggered.
tolerance (default: 0)
During the delay period, if the user moves the mouse cursor beyond the number of pixels specified by this option, then the user is considered to be not holding the mouse.
mouseholddeactivate and mouseholdcancel event will be triggered if cursor movement exceeds tolerated number of pixels.
mouseholdactivate
This event is triggered when user presses the mouse button. At this point, mousehold is on a delay phase where cursor movements will cancel the mousehold event.
mouseholdstart
This event is triggered when user is still holding the mouse button after the initial delay phase as specified by the delay option. This event confirms that user is really holding the mouse button and not performing other operations like text selection.
mousehold
This event is triggered when user has been holding the mouse button for the amount of time specified by the duration option.
mouseholdcancel
This event is triggered when user releases the mouse button after passing the intial delay phase but not long enough for the amount of time specified by the duration option.
mouseholddeactivate
This event is triggered everytime when user releases the mouse button.
Dual licensed under the MIT and GPL licenses.
Plugin written by Jensen Tonne.