# @analytics/scroll-utils

> Scroll utility library to fire events on scroll

Latest version **0.1.26** (published 2025-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @analytics/scroll-utils
pnpm add @analytics/scroll-utils
yarn add @analytics/scroll-utils
bun add @analytics/scroll-utils
```

## Health

**Score 40/100 (D)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.1.26 |
| Published | 2025-08-07 |
| First published | 2020-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 110.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2671 |
| Author | David Wells |
| Maintainers | davidwells |
| Keywords | analytics, analytics-project, analytics-util, scroll, scroll-percentage |

## Links

- npm: https://www.npmjs.com/package/@analytics/scroll-utils
- Repository: https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-scroll
- Homepage: https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-scroll#readme
- npm.io page: https://npm.io/package/@analytics/scroll-utils

## Dependencies (2)

- [analytics-utils](https://npm.io/package/analytics-utils.md) ^1.1.1
- [@analytics/type-utils](https://npm.io/package/@analytics/type-utils.md) ^0.6.4

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.1.26 (latest) — 2025-08-07
- 0.1.25 — 2025-08-06
- 0.1.24 — 2024-12-12
- 0.1.23 — 2024-12-11
- 0.1.22 — 2023-05-27
- 0.1.21 — 2023-05-27
- 0.1.20 — 2022-03-18
- 0.1.19 — 2022-02-05
- 0.1.18 — 2022-01-03
- 0.1.17 — 2022-01-02
- 0.1.16 — 2021-12-12
- 0.1.15 — 2021-10-24
- 0.1.14 — 2021-10-17
- 0.1.13 — 2021-08-27
- 0.1.12 — 2021-08-05
- … 12 more at https://npm.io/package/@analytics/scroll-utils/versions

## README

<!--
title: Scroll Utils
pageTitle: Scroll Utils
description: Utility library for dealing with scroll events
-->
# Scroll Utilities

A tiny utility library for working with scroll events in <!-- AUTO-GENERATED-CONTENT:START (pkgSize) -->`972 bytes`<!-- AUTO-GENERATED-CONTENT:END -->.

[See live demo](https://utils-scroll.netlify.app/).

## How to install

Install `@analytics/scroll-utils` from [npm](https://www.npmjs.com/package/@analytics/scroll-utils).

```bash
npm install @analytics/scroll-utils
```

## API

Below is the api for `@analytics/scroll-utils`. You can import only what you need & the rest will be tree-shaken out of your bundle.

## `onScrollChange`

Listen to form submissions & do stuff with inputs.

This will incept form submissions & fire a custom callback before submitting the form normally

```js
import { onScrollChange } from '@analytics/scroll-utils'

const detachScrollListener = onScrollChange({
  25: (scrollDepth, maxScroll) => {
    console.log('25 % scrolled', scrollDepth)
  },
  50: (scrollDepth, maxScroll) => {
    console.log('50 % scrolled', scrollDepth)
  },
  75: (scrollDepth, maxScroll) => {
    console.log('75 % scrolled', scrollDepth)
  },
  90: (scrollDepth, maxScroll) => {
    console.log('90 % scrolled', scrollDepth)
  },
})

// Detach listener
detachScrollListener()
```

## Alternative libraries

- [Update On Scroll (uos)](https://github.com/vaneenige/uos)
- [overunder](https://github.com/estrattonbailey/overunder)

---
_Source: https://npm.io/package/@analytics/scroll-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
