Skip to content


Subversion checkout URL

You can clone with
Download ZIP
:v: jQuery touch & gestures, fingers in the nose.
JavaScript Other
Latest commit 90fd17e @ngryman Merge pull request #43 from ozio/browserify-fix
Browserify can't find package when require('jquery.finger')

jQuery Finger Version

Build Status Dependency Status Size Gittip

jQuery tap & gestures, fingers in the nose.

Finger unifies click and touch events by removing the 300ms delay on touch devices. It also provides a common set of events to handle basic gestures such as flick, drag, press and double tap.
Very small (< 0.5kb gzipped), it is focused on performance and KISS, is well tested and also supports jQuery delegated events.

Getting Started

Download the production version (1K gzipped) or the development version (4K).
You can also install it via Jam or Bower.

In your web page:

<script src="jquery.js"></script>
<script src="dist/jquery.finger.min.js"></script>
  // direct event
  $('.touchme').on('tap', function() {

  // delegated event
  $('body').on('tap', '.touchme', function() {



Finger focuses on one finger events:

tap doubletap press drag flick


You can tweak how Finger handles events by modifying thresholds found in the $.Finger object.


This is the time the user will have to hold in order to fire a press event. If this time is not reached, a tap event will be fired instead. This defaults to 300ms.


This is the maximum time between two tap events to fire a doubletap event. If this time is reached, two distinct tap events will be fired instead. This defaults to 300ms.


This is the maximum time the user will have to swipe in order to fire a flick event. If this time is reached, only drag events will continue to be fired. This defaults to 150ms.


This is the number of pixel the user will have to move in order to fire motion events (drag or flick). If this time is not reached, no motion will be handled and tap, doubletap or press event will be fired. This defaults to 5px.

Additional event parameters

Finger enhances the default event object when there is motion (drag & flick). It gives information about the pointer position and motion:

  • x: the x page coordinate.
  • y: the y page coordinate.
  • dx: this x delta (amount of pixels moved) since the last event.
  • dy: this y delta since the last event.
  • adx: this x absolute delta since the last event.
  • ady: this y absolute delta since the last event.
  • orientation:
    • horizontal: motion was detected as an horizontal one. This can be tweaked with $.Finger.motionThreshold.
    • vertical: motion was detected as a vertical one. This can be tweaked with $.Finger.motionThreshold.
  • direction:
    • 1: motion has a positive direction, either left to right for horizontal, or top to bottom for vertical.
    • -1: motion has a negative direction, either right to left for horizontal, or bottom to top for vertical.
  • end: true if motion has stopped, else false.

Prevent default behavior

There are three ways of preventing default behavior.


You can prevent every native behavior globally:

$.Finger.preventDefault = true;


You can prevent default behavior, just like any other standard events:

$('body').on('tap', '.touchme', function(e) {
    // ...

Note that if you bind multiple events of the same type on the same element, and one of them is preventing default, every trigger of that event will implicitly prevent default of other bound events.

press event can only be prevented globally, not specifically.

Original event

Internally Finger binds a global touch / mouse event to do its duty. This native event can be accessed via the e.originalEvent property. This is a shared event, that means that this will be the same object across all your handlers.

With this original event you are able to decide how you want to prevent default behavior by adding any logic in any of your handlers.

This is an example on how to prevent horizontal scrolling, but not vertical:

$('body').on('drag', '.drag', function(e) {
    // let the default vertical scrolling happen
    if ('vertical' == e.orientation) return;

    // prevent default horizontal scrolling


This is how Finger prevents default behavior:

tap doubletap press drag flick globally
touchstart / mousedown
touchmove / mousemove
touchend / mouseup

More details.


Remove the 300ms delay on every links of your page

$('body').on('tap', 'a', function(e) {
    window.location = $(this).attr('href');

Delegated events for dynamically loaded elements (AJAX):

$('body').on('tap', '.toggle', function() {

Swipe to reveal

$('#menu').on('flick', function(e) {
    if ('horizontal' == e.orientation) {
        if (1 == e.direction) {
        else {


  • Finger uses VirtualPointer in its test suite to simulate mouse and touch events.
  • On Chrome 25+, preventDefault does not work as expected because ontouchstart is defined. To make it work, you have to manually prevent the default behavior in the mousedown or click event.
  • When using flick or drag event on an image, you have to set user-drag: none on it (and the prefixed versions).


Projects using Finger

Release History

 - fixed dragging across children of an element (#10).

 - fixed `preventDefault` on desktop browsers for `tap` and `doubletap` events (#24).

 - stable release.

 - fixed Chrome desktop and false positive touch detection.
 - fixed drag events with a correct end flag value (#17).

v0.1.0-beta.1 (buggy)
 - fixed successive taps to fail on different elements.

v0.1.0-beta (buggy)
 - better prevent default logic (#9, #12).
 - huge internal refactoring.

 - give access to original events (#12).

 - ie8 legacy support.
 - fixed prevent default event parameter.

 - `press` event is now fired by `timeout` instead of `touchend`.

 - fixed events fired multiple times (#1).
 - added `preventDefault` support.
 - internal refactoring for size and performance.

  - fixed incorrect event type.
  - added to jam.
  - added to bower.

  - fixed bugs on delegated events.
  - better cross-browser support (still needs some work/tests).
  - internal refactoring for consistency and performance.

  - various cross browsers fixes.

  - updated description.

  - updated jquery manifest and published on

  - added `drag` and `flick` gestures.
  - enhanced `event` object.
  - internal refactoring for consistency.

  - migration to **grunt** 0.4.
  - migration to **mocha** / **chaijs** for tests.

  - added `doubletap` and `press` gestures.
  - internal refactoring for consistency and performance.

  - `tap` gesture first implementation.


Nicolas Gryman

Something went wrong with that request. Please try again.