0.1.3 • Published 10 months ago

smart-swipe-controller v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

smart-swipe-controller

Lib simple add additional tap events in HTML element additional events:

  • swipeLeft - swipe from right to left
  • swipeRight - swipe from left to right
  • swipeUp - swipe from bottom to top
  • swipeDown - swipe from top to bottom
  • tap - one tap

Usage

VIA NPM

  1. npm install smart-swipe-controller
  2. Import controller to your project
     import { SmartSwipeController } from "smart-swipe-controller";
  3. Add it to HTML element
     new SmartSwipeController(HTML_Element);

Classic import method

Include SmartSwipeController and add additional events to HTML element like this

  • If you want include as a module Copy file from this (or minify version) to your project folder
    <script type="module">
    import { SmartSwipeController } from "./smartSwipeController.esm.js";
    new SmartSwipeController(HTML_Element, 30)
    </script>
  • If you want include as iife-style (you need use global object SSC) Copy file from this (or minify version) to your project folder
    <script src="smartSwipeController.iife.js"></script>
    <script>
    new SSC.SmartSwipeController(HTML_Element, 30);
    </script>

Subscribe to additional events

 HTML_Element.addEventListener("swipeleft", () => {
     ...
 });

 HTML_Element.addEventListener("swiperight", () => {
     ...
 });

 HTML_Element.addEventListener("swipeup", () => {
     ...
 });

 HTML_Element.addEventListener("swipedown", () => {
     ...
 });

 HTML_Element.addEventListener("tap", () => {
     ...
 });
0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago