Skip to content

A jQuery plugin that makes it easy to support long press events on mobile devices and desktop borwsers.

Notifications You must be signed in to change notification settings

vaidik/jquery-longpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

longpress: a jQuery plugin

Longpress is a jQuery plugin that makes it easy to support long press events on mobile devices and desktop borwsers.

Native Library

If you want something native and more low level than the jQuery implementation, take a look at longpress.js that is also written by me.

Quick Usage

<script type="text/javascript" src="jquery.longpress.js"></script>
$('#button').longpress(function() {
    // longpress callback
    alert('You just longpress-ed a button.');
});

Detailed Usage

.longpress(longpressHandler(event)[, shortpressHandler(event), duration])

longpressHandler(event) Required Type: Function() A function to execute each time someone longpresses something.
shortpressHandler(event) Optional Type: Function() A function to execute each time someone releases the mouse or touch before the longpress duration elapses.
duration Optional Type: Integer longpress duration in milliseconds.

Example:

$('#button').longpress(function(e) {
    alert('You just longpressed something.');
}, function(e) {
    alert('You released before longpress duration and that\'s why its a shortpress now.');
});

Author

Vaidik Kapoor (@vaidikkapoor)

Other

MIT License

Copyright (c) 2008-2013, Vaidik Kapoor (kapoor [dot] vaidik -[at]- gmail [dot] com)

About

A jQuery plugin that makes it easy to support long press events on mobile devices and desktop borwsers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published