Press "Enter" to skip to content

Simple Touch Swipe With Vanilla JavaScript | swiped-events

Simple Touch Swipe – pure-swipe is a JavaScript-based swipe occasions detection library that provides lacking swiped-left, swiped-right, swiped-up and swiped-down events to the addEventListener() API.

How to make use of it:

Download and import the JavaScript file pure-swipe.js into the doc.

Specify the event varieties to hear for.

// swiped-left
document.addEventListener('swiped-left', function(e) {
  // ...
});

// swiped-right
document.addEventListener('swiped-right', function(e) {
  // ...
});

// swiped-up
document.addEventListener('swiped-up', function(e) {
  // ...
});

// swiped-down
document.addEventListener('swiped-down', function(e) {
  // ...
});

Customize the pure-swipe through HTML5 information attributes as follows:

  • data-swipe-threshold: set how far the consumer should swipe earlier than it’s thought-about a swipe
  • swipe-timeout: timeout in milliseconds
  • ignore: disable the event detection on this component?
Swipe me

Detect Finger Swipe Events With JavaScript, Touch-Swipe Detection in Pure Javascript

Changelog:

v1.1.3 (08/29/2020)

  • Config attributes can now be added to parent parts

02/02/2018

  • renamed to swiped-events

See Demo And Download

Official Website(john-doherty): Click Here

This superior jQuery/javascript plugin is developed by john-doherty. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *