THEMETRIAL

Minimal JavaScript Library For Handling Touch Swipe Events – LC-Swiper

Author:LCweb-ita
Views Total:0 views
Official Page:Go to website
Last Update:April 30, 2021
License:MIT

Preview:

Minimal JavaScript Library For Handling Touch Swipe Events – LC-Swiper

Description:

LC-Swiper is a tiny JavaScript library (ES6) designed for handling touch swipe events on given elements.

How to use it:

1. Import the JavaScript file lc-swiper.js into the document.

<script src="https://www.cssscript.com/lc-swiper.min.js"></script>

2. Create a new instance of the LC-Swiper and determine the target element on which you want to detect touch swipe events.

<div id="targetContainer">
  <h2>Swipe here!</h2>
</div>
const swiper = new lc_swiper('#targetContainer');

3. Trigger a function every time you swipe on that element.

const swiper = new lc_swiper('#targetContainer', function(directions, $el){
      // do something
      // directions.top
      // directions.right
      // directions.bottom
      // directions.left
});


Source link

Add comment

NOTE :

All visitors can share my site’s content on their blogs, sites, and social networks to enrich the content

Only share the source www.themetrial.com

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.