1.0.6 • Published 7 years ago

@ryanburnette/scroll-direction v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
7 years ago

Scroll Direction

npm version

This library is my approach to gracefully detecting vertical scroll direction in a browser. It works by keeping track of a series of throttled detect events, then invoking a callback with a direction argument once the series contains only one event direction.

Usage

var s = new ScrollDirection(function (dir) {
  console.log(dir)
})

Options

There are two options, series and throttle. Tweak the options to get the desired behavior.

var options = {
  series: 5,
  throttle: 100
}
new ScrollDirection(callback,options)

Destroy

s.destroy()

Installation

As a library consumed and packaged by something like Webpack or Rollup.

npm install @ryanburnette/scroll-direction
var ScrollDirection = require('@ryanburnette/scroll-direction')

From a CDN.

<script src="https://unpkg.com/@ryanburnette/scroll-direction@1.0.5/dist/scroll-direction.min.js" type="text/javascript"></script>
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago