Get started with jquery.touchswipe CDN

(MIT OR GPL-2.0) licensed

JQuery.touchSwipe is a lightweight library for detecting and handling touch swipe gestures on mobile devices.

Tags:
  • touch
  • swipe
  • mobile
  • jquery

Stable version

Copied!

How to start using jquery.touchswipe CDN


$(document).ready(function() {
  // Select the element you want to swipe on
  $(".swipe-container").swipe({
    swipeLeft: function(event, direction, distance, duration, fingers) {
      // Add your code here for left swipe event
      console.log("Swipe left!");
    },
    swipeRight: function(event, direction, distance, duration, fingers) {
      // Add your code here for right swipe event
      console.log("Swipe right!");
    },
    allowPageScroll: "vertical" // Allow page scrolling when swiping horizontally
  });
});
Copied!
Copied!

All versions