Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scroll-detector

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-detector

detects scroll direction, position and emits events

  • 0.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
556
decreased by-1.24%
Maintainers
1
Weekly downloads
 
Created
Source

scrollDetector

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

Latest NPM release MIT License

Example

  • basic

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.

Keywords

FAQs

Package last updated on 24 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc