Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
README.md
demo.html
jquery.swipe.js

README.md

jquery.swipe

This is a simple implementation of swipe detection and handling for jquery.

usage

$("#foo").swipe(function(e){
  console.log(e.direction);
});

This will be an exclusive handling of touchmove, if you need other touchmove handlers to fire (including the native one), you need to pass in a configuration.

$("#foo").swipe({ preventDefaultEvents: false }, function(e){
  console.log(e.direction);
});

configuration options

  • preventDefaultEvents: true/false, allow the browser to fire the event. defaults to false
  • thresholdX: the distance you need to swipe in the x axis to consider it a horizontal swipe. defaults to 20
  • thresholdY: the distance you need to swipe in the y axis to consider it a vertical swipe. defaults to 20
Something went wrong with that request. Please try again.