Skip to content
A jQuery plugin that makes it easy to support long press events on mobile devices and desktop borwsers.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
jquery.longpress.js

README.md

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)

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.