Socket
Socket
Sign inDemoInstall

swipeit

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    swipeit

Javascript Module to handle swipe events on DOM elements - that emits events on swipe.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
5.68 kB
Created
Weekly downloads
 

Readme

Source

swipeit

swipeit is a simple touch event manager for detecting Swipe on a DOM Element. Once registered it emits events when it's swiped; I decided to use cardinal events because it seems more direct than left, right. So events are east, west, north and south.

swipeit is a Javascript Module, when it's compiled with Browserify it works out of the box - if module is not found then it will bind itself to window under the variable swipeit. ie: window.swipeit;

Install

npm install Swipeit --save

Usage

var swipeit = require("swipeit");

var element = document.querySelector("div.swipable");

var swipeit = new Swipeit(element);

swipeit.on("east", function(){
	.....
})

API

var swipeit = new Swipeit( ELEMENT );

Creates a new swipper for the DOM Element passed as argument. You can create many swipper instances for different elements.

swipeit.on( EVENT , callback );

EVENT can be east, west, north and south

The callback is a function, it is passed a parameter with the following object:

{ 
  amount: the swipe amount in pixels 
  event: the original swipe ( touchmove ) event
}

Collaboration and Todo

Open to any suggestion - just send a pull request.

Todo: Make it compatible with other require.js and ES6 Modules.

Keywords

FAQs

Last updated on 10 Jan 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc