JavaScript Library For Handling Swipe Up/Down/Left/Right Events – basicSwipe.js

Category: Javascript | August 6, 2021
Author:taosapp
Views Total:203 views
Official Page:Go to website
Last Update:August 6, 2021
License:MIT

Preview:

JavaScript Library For Handling Swipe Up/Down/Left/Right Events – basicSwipe.js

Description:

A basic touch gesture handling library that allows you to add swipeUp, swipeDown, swipeLeft, and swipeRight event listeners on any DOM elements.

How to use it:

1. Import the basicSwipe.js JavaScript library.

<script src="./basicSwipe.js"></script>

2. Add swipe event listeners to elements as follows:

var example = document.querySelector('.example'),
addSwipeEvent(example, "swipeUp", function(){
  // do something
});
addSwipeEvent(example, "swipeDown", function(){
  // do something
});
addSwipeEvent(example, "swipeLeft", function(){
  // do something
});
addSwipeEvent(example, "swipeRight", function(){
  // do something
});

You Might Be Interested In:


Leave a Reply