1.0.4 • Published 2 years ago
track-scrolling v1.0.4
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]:
```bash
npm install track-scrollingThen you can import it
import TrackScrolling from "track-scrolling";
It takes following params
scrollDepthsan Array of depths you want to be tracked and have your callback called on.callBackthe callback to be called when certain percentages are reached when scrolling.returnErrora boolean to send if you want any error to be returned.