Skip to content

Smart, lightweight functions to animate browser scroll.

Notifications You must be signed in to change notification settings

jaydenseric/scroll-animator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: