Socket
Socket
Sign inDemoInstall

swipyjs

Package Overview
Dependencies
0
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    swipyjs

A lightweight JavaScript library for simple touch swipe gesture events


Version published
Weekly downloads
17
decreased by-26.09%
Maintainers
2
Install size
12.1 kB
Created
Weekly downloads
 

Readme

Source

Swipy

A lightweight JavaScript library for simple touch swipe gesture events.

Installation

NPM

npm i swipyjs

Yarn

yarn add swipyjs

Usage

Define Swipy event listeners by calling on(event, callback):

let swipy = new Swipy(document.getElementById('swipy-container'));

swipy.on('swipeleft', function(event, touches) {
    console.log('Swiped to the left!');
});

The callback function receives two parameters:

  • event: the last native touchmove event that was triggered.
  • touches: an object containing the current touch coordinates:
{
    down: {x: null, y: null},
    up: {x: null, y: null},
    diff: {x: null, y: null}
}

Methods

swipy.on(event, callback)

Registers a new Swipy event listener.

Available events are:

  • swipetop
  • swiperight
  • swipebottom
  • swipeleft

swipy.bind()

Adds the native event listeners used by the library.

swipy.unbind()

Removes the native event listeners used by the library.

swipy.trigger(listener, event)

Manually triggers a defined Swipy event.

Keywords

FAQs

Last updated on 29 Sep 2022

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