has-scrolled
Add scroll info to elements.
Last updated 8 months ago by entozoon .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install has-scrolled 
SYNC missed versions from official npm registry.

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"
});

Current Tags

  • 1.2.0                                ...           latest (8 months ago)

12 Versions

  • 1.2.0                                ...           8 months ago
  • 1.1.0                                ...           10 months ago
  • 1.0.10                                ...           a year ago
  • 1.0.9                                ...           a year ago
  • 1.0.8                                ...           a year ago
  • 1.0.7                                ...           a year ago
  • 1.0.6                                ...           a year ago
  • 1.0.5                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |