0.7.1 • Published 12 months ago

scroll-detector v0.7.1

Weekly downloads
12
License
MIT
Repository
github
Last release
12 months 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

12 months ago

0.7.0

12 months ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.4

5 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago