scroll-bounds

0.0.3 • Public • Published

ScrollBounds

Event emitter for scroll boundaries. Useful when you want to know if the target element has been scrolled to its edges.

Currently only top and bottom are supported.

Usage

npm install scroll-bounds --save
var scrollBounds = require('scroll-bounds');
 
var b = scrollBounds(document.getElementById('outer'));
 
b.on('top', function () { console.log('TOP'); });
b.on('bottom', function () { console.log('BOTTOM'); });
b.on('break', function (boundary) { console.log('was: ', boundary); });

Events

b.on('top', cb)

When the target viewport has scrolled to the top.

b.on('bottom', cb)

When the target viewport has scrolled to the bottom.

b.on('break', cb)

When the initial scroll position at time of scrolling is at a boundary and then scrolled away from. cb will contain the last set boundary.

Scrolllll

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    1
  • 0.0.2
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i scroll-bounds

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • drk