track-scrolling

1.0.4 • Public • Published

Track Scrolling

A small library for tracking the scroll of the user in the browser and having a callback run on scroll percentages sent.

/*
 * Log to the console whenever the document.body element
 * enters one of the defined percentages .
 */
TrackScrolling([20, 30, 60, 90], (percentageReached) => console.log("Percentage Scrolled:", percentageReached));


Table of Contents
-----------------

  * [Requirements](#requirements)
  * [Usage](#usage)


Requirements
------------
a normal npm package can be used with webpack.

Usage
-----

Track Scrolling is easiest to use when installed with [npm]:

```sh
npm install track-scrolling

Then you can import it import TrackScrolling from "track-scrolling";

It takes following params

  • scrollDepths an Array of depths you want to be tracked and have your callback called on.
  • callBack the callback to be called when certain percentages are reached when scrolling.
  • returnError a boolean to send if you want any error to be returned.

Readme

Keywords

Package Sidebar

Install

npm i track-scrolling

Weekly Downloads

2

Version

1.0.4

License

none

Unpacked Size

3.8 kB

Total Files

5

Last publish

Collaborators

  • cutjavascript