Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrkmg/jquery.onhold

A jQuery plugin for detecting onHold events
https://github.com/mrkmg/jquery.onhold

Last synced: 16 days ago
JSON representation

A jQuery plugin for detecting onHold events

Awesome Lists containing this project

README

        

This is free software. This software may be distributed under the terms of this General Public License v2.
http://www.gnu.org/licenses/gpl-2.0.html
--MrKmg

callback : function(ev)

Options:

time: Period of time a user should have to hold their mouse button down on an object to fire the event;
Measured in Milliseconds
Defaults to 5000
click: Which mouse buttons should count
left, middle, right, left_right, or all
defaults to all

Examples

using defaults (5 seconds, any mouse button)
$(selector/object).onHold(function(ev){ alert('onHold fired') });

Custom options (1 second, only left mouse button
$(selector/object).onHold(function(ev){ alert('onHold fired') },{time:1000,click:'left'});

see an example working here:
http://jsfiddle.net/YvZcS/