onClickHold is a jQuery plugin that adds a custom "on click & hold" event. You can try it out by clicking & holding (duh) your primary mouse button anywhere on this page. The few options that it has are explained below. Also note that this stuff is provided as-is with no guarantees.
Note that it is not possible to use .bind(), .live(), or .delegate() to bind listeners to this event. For that, I still need to figure out a good way to trigger the custom event without listening for mouse events on all the elements on the page, or the entire page itself. Any suggestions are welcome.
Fairly straightforward:
$(selector).clickhold(function(event){
// do something interesting here
// selector can be any jQuery selector
// event will contain the event object, which is actually just
// an 'extension' of the original mousedown event
});
You can unbind the custom event (and all mouse event that it binds to) using .unClickhold()., passing it a reference to the original listener.
There are a few options that can be passed in an object as the second argument.