0.1.20 • Published 5 months ago

@analytics/scroll-utils v0.1.20

Weekly downloads
53
License
MIT
Repository
github
Last release
5 months ago

Scroll Utilities

A tiny utility library for working with scroll events in 972 bytes.

See live demo.

How to install

Install @analytics/scroll-utils from npm.

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

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

0.1.20

5 months ago

0.1.16

8 months ago

0.1.17

7 months ago

0.1.18

7 months ago

0.1.19

6 months ago

0.1.14

10 months ago

0.1.15

10 months ago

0.1.13

12 months ago

0.1.12

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago