Skip to content

jaydenseric/scroll-animator

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

scroll-animator

Smart, lightweight functions to animate browser scroll.

  • Scroll the page or a specific element.
  • Scroll vertically and horizontally.
  • Scroll to a target element or an arbitrary position, with an optional offset.
  • Scroll animations can be interrupted by the user or other scripts (no “fighting” animations).
  • Scroll animations adapt to a moving target; handy when loading affects layout.
  • Intuitive easeInOutCubic animation timing; a soft acceleration and deceleration.
  • < 1 kB bundle size, tested.
  • SSR friendly.

Installation

For Node.js, to install scroll-animator with npm, run:

npm install scroll-animator

For Deno and browsers, an example import map:

{
  "imports": {
    "scroll-animator/": "https://unpkg.com/scroll-animator@4.0.0/"
  }
}

Requirements

Supported runtime environments:

Consider polyfilling:

Non Deno projects must configure TypeScript to use types from the ECMAScript modules that have a // @ts-check comment:

Exports

The npm package scroll-animator features optimal JavaScript module design. It doesn’t have a main index module, so use deep imports from the ECMAScript modules that are exported via the package.json field exports: