jQuery Plugin To Track Mouse Scroll And Mobile Touch Events - Swipe-Trigger

File Size: 6.11 KB
Views Total: 1890
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Track Mouse Scroll And Mobile Touch Events - Swipe-Trigger

Swipe-Trigger is a tiny jQuery plugin which keeps track of mouse scroll and mobile touch events and triggers certain callback functions on scroll up/down and/or swipe left/right/up/down.

How to use it:

1. Download and load the jQuery swipe-trigger plugin after you've loaded jQuery library.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="js/scroll.js"></script>

2. Initialize the plugin and setup the callback functions you want to trigger.

$('#container').scrolltrigger({
  swipeUp : function() {
    // Do something
  },
  swipeDown : function() {
    // Do something
  },
  swipeLeft : function() {
    // Do something
  },
  swipeRight : function() {
    // Do something
  },
  scrollUp : function() {
    // Do something
  },
  scrollDown : function() {
    // Do something
  }
});

3. Configuration options with default values.

$('#container').scrolltrigger({
  lastAnimation   : 0,
  quietPeriod     : 100,
  animationTime   : 100,
  swipeMode       : true,
});

This awesome jQuery plugin is developed by tommychoo. For more Advanced Usages, please check the demo page or visit the official website.