0.7.1 • Published 2 years ago

scroll-detector v0.7.1

Weekly downloads
12
License
MIT
Repository
github
Last release
2 years ago

scrollDetector

scrollDetector detects scroll event types: scroll derection and whether page-top or page-bottom or middle.

Latest NPM release MIT License

Example

Usage

$ npm install --save scroll-detector

then

import scrollDetector from 'scroll-detector';

scrollDetector.on( 'scroll', () => {
	console.log( 'scroll' );
} );

scrollDetector.on( 'scroll:up', () => {
	console.log( 'scroll:up' );
} );

scrollDetector.on( 'scroll:down', () => {
	console.log( 'scroll:down' );
} );

scrollDetector.on( 'at:top', () => {
	console.log( 'at:top' );
} );

scrollDetector.on( 'at:bottom', () => {
	console.log( 'at:bottom' );
} );

Other features

  • scrollDetector.isPageTop() whether at the page top or not.
  • scrollDetector.isPageBottom() whether at the page bottom or not.
  • scrollDetector.off( eventName, func ) to remove the listener.
  • scrollDetector.getScrollTop() will return scrollTop amount in pixels.
  • scrollDetector.mute() to disabled the detector.
  • scrollDetector.unmute() to re-enable the detector.
0.7.1

2 years ago

0.7.0

2 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.0

5 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago