Skip to content

A touchevent swipe detection utility for JavaScript applications.

License

Notifications You must be signed in to change notification settings

rquanx/swipe-detect

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swipe-detect

npm CircleCI (all branches) License: MIT

A touchevent swipe detection utility for JavaScript applications.

Install

$ npm install --save swipe-detect

or

$ yarn add swipe-detect

Usage

import swipeDetect from 'swipe-detect';

swipeDetect(TARGET_DOM_NODE, YOUR_CALLBACK, THRESHOLD_FOR_SWIPE);

Where TARGET_DOM_NODE is the element you want to listen for swipes on, YOUR_CALLBACK is the function that should be called when a swipe occurs, and THRESHOLD_FOR_SWIPE is an int representing the pixels you want a swipe to gather before it is considered a swipe. Defaults to 150.

The callback will receive either 'left', 'right', 'up' or 'down'.

Contributing

Create an Issue if there is not already one created. Open up a Pull Request against master with your fix branch.

Install Dependencies

$ npm install

Run Tests

$ npm test

About

A touchevent swipe detection utility for JavaScript applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%