1.2.0 • Published 5 years ago

has-scrolled v1.2.0

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

Has Scrolled

Add scroll info to elements.

Install

npm i has-scrolled

Integrate

import hasScrolled from "has-scrolled";
hasScrolled();

Or, if you're compiling your own Typescript like a good little dev

import hasScrolled from "has-scrolled/index";
hasScrolled();

That's all well and good, but what does it do?

As you scroll down, it'll add a class and data attributes like so:

<body class="has-scrolled" data-scroll-y="120"></body>

Moar Powar!

If you want scroll info for within another element, for it to add a suffixed class to a separate element, or tweak any other default config values:

hasScrolled({
  element: document.querySelector("nav"),
  target: document.querySelector("body"),
  minScroll: 100,
  scrollTolerance: 50,
  class: "has-scrolled-foo"
});
1.2.0

5 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago