Skip to content

A deadly simple scroll progress indicator based on css and a bunch of js.

License

Notifications You must be signed in to change notification settings

colin-alexander-dmfa/scrolles

Repository files navigation

Scrolles

A deadly simple and higlhy customizable scroll progress indicator.

Installation

yarn add scrolles

Usage

Import the function and pass the optional configuration:

import { Scrolles } from 'scrolles';

const scrollIndicator = Scrolles({
  selector: '[data-scrolles]',
  mode: 'continuous',
});

Then you can add the selector you've defined to any not-void/replaced element (any element that can contains pseudo elements):

<html lang="en" data-scrolles>
   <head>
   </head>
   <body>
      <div data-scrolles>
         ....
      </div>
   </body>
</html>

Finally, add this small and optional CSS snippet if you want to customize the progress indicator, by changing the default values.

[data-scrolles]{
   --scrolles-height: 3px;
   --scrolles-fill: hotpink;
   --scrolles-margin: 0;
   --scrolles-easing: cubic-bezier(0.25, 1, 0.5, 1);
}

Note: [data-scrolles] is the dafult selector, if you change it, you have to change it also inside the CSS.

About

A deadly simple scroll progress indicator based on css and a bunch of js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published