updwn

1.0.0 • Public • Published

updwn

Detect up/down directional scrolling. 500 bytes gzipped.

Install

npm i updwn --save

Usage

Handlers are only fired when the scroll direction changes and the scroll speed exceeds a configurable threshold value.

import updwn from 'updwn'
 
const scroll = updwn({ speed: 50 })
 
scroll.up(() => { /* up */ })
scroll.down(() => { /* down */ })
 
scroll.position // => 'up' or 'down'

Handlers can be destroyed by calling the function returned at the time of their definition.

const destroy = scroll.up(() => { /* up */ })
 
destroy()

License

MIT License © Eric Bailey

Readme

Keywords

none

Package Sidebar

Install

npm i updwn

Weekly Downloads

9

Version

1.0.0

License

MIT

Unpacked Size

14.4 kB

Total Files

8

Last publish

Collaborators

  • estrattonbailey