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

scroll-test

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-test

Provides a function to allow testing whether a user has scrolled past an element or to the bottom of the viewport.

  • 1.0.0-alpha.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Scroll Test

This module provides a function to test whether the user has scrolled past an element or has scrolled to the bottom of the page.

Getting Started

npm install scroll-test

You only need to import this file into your build:

dist/scroll-test.js

Once its imported, you'll be able to test the scroll like this:

var element = document.querySelector('.js-my-element');
scrollTest(window, element);

or like this, for the document itself:

scrollTest(window);

scrollTest() will return true if the user has scrolled the viewport passed the bottom of the element, or up to the bottom of the page.

Parameters for the test function

ParameterPurpose
windowNeeds window for getting the current height of the viewport
element (optional)If passed, will compare the height of the viewport vs the bottom of the element. If not passed, will compare the height of the viewport against the height of the page.

Contribution

  • Fork, open a PR

FAQs

Package last updated on 02 Jun 2017

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