Skip to content

yansern/jquery.mousehold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

jquery.mousehold

Mousehold event for jQuery.

Usage Example

$(elem)
	.on("mousehold",
		{
			duration: 1000,
			delay: 500,
			tolerance: 0
		},
		function(){
			console.log("User is holding the mouse button.");
		});

Options

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.

Events

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.

License

Dual licensed under the MIT and GPL licenses.

Plugin written by Jensen Tonne.

About

Mousehold event for jQuery.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published