node package manager

scrolltrigger

Scrolltrigger

Fire callbacks as you scroll (or a low-level version of Waypoints).

Install

With npm do:

npm install scrolltrigger

Usage

var Scrolltrigger = require('scrolltrigger')
 
var triggers = new Scrolltrigger(window, 'y')
 
// `callback` will fire when the `window` scroll position reaches 1000 pixels 
triggers.add({
  threshold: function () {
    return 1000
  },
  callback: function (direction, trigger) {
    console.log(direction) // 1 is forward, -1 is backwards 
    // => 1 
  }
})

License

MIT