Handling Scroll Start And Scroll Stop Events In jQuery - scrollstop.js

Handling Scroll Start And Scroll Stop Events In jQuery - scrollstop.js
File Size: 7.22 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

scrollstop.js is a jQuery plugin for handling scroll events that has the ability to fire events when the user starts and stops scrolling.

How to use it:

1. Just put the JavaScript file scrollstop.js after jQuery library and we're ready to go.

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

2. Attach the scrollStart and scrollStop events to the selected elements.

$('element')
  .on("scrollstart", function() {
    // do something
  })
  .on("scrollstop", function() {
    // do something
  })

3. Setup the the minimum time between the last scroll event and when the scrollStop event fires.

$.event.special.scrollstop.latency = 250;

// or

$('element')
  .on("scrollstop", {latency: 250}, function() {
    // do something
  })

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