scrolltrigger

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
scrolltrigger
001.0.16 years ago6 years agoMinified + gzip package size for scrolltrigger in KB

Readme

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