JSPM

  • Created
  • Published
  • Downloads 13440
  • Score
    100M100P100Q144548F
  • License MIT

Primitive to manage scrolling

Package Exports

  • @solid-primitives/scroll

Readme


Name: scroll Stage: 3 Package: "@solid-primitives/scroll" Primitives: createScrollObserver Category: Display & Media

@solid-primitives/scroll

lerna size size

Helpful primitives to manage browser scrolling.

createScrollObserver - Helpful monitor that reports the current position of an element or window.

Primitive ideas:

createScrollTo - A primitive to support scroll to a target createHashScroll - A primitive to support scrolling based on a hashtag change

How to use it

const position = createScrollObserver();

or

let ref;
const position = createScrollObserver(() => ref);

Demo

You may view a working example here: https://codesandbox.io/s/solid-primitives-scroll-csg7f

Changelog

Expand Changelog

0.0.100

Initial porting of the scroll primitive.

1.0.2

Released new version with CJS support.

Contributors

Ported from the amazing work by at https://github.com/dance2die/react-use-localstorage.