Skip to content

zhangyu1818/scroll-progress-bar

Repository files navigation

scroll-progress-bar

npm-version bundlesize-js-image

A progress bar for scroll, support SSR.

Install

npm install scroll-progress-bar
yarn add scroll-progress-bar

Usage

import progressBar from 'scroll-progress-bar';
import "scroll-progress-bar/style.css";

// show scroll progress bar
progressBar.show();
// hide scroll progress bar
progressBar.hide();
// set scroll progress bar configuration
progressBar.setConfig({
    debounce: true,
})

configuration

export interface ScrollProgressConfig {
  // element id
  id?: string
  // element scroll offset
  offset?: number
  // scroll debounce
  debounce?: boolean
}