npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

sprogress

v1.1.2

Published

Progress bar on Scroll

Readme

Table of Contents

Introduction

SProgress is a simple on-scroll progress bar developed for web apps. It aims to give a user feedback as to how far they are in an article. Inspired by Alligator.io. A brief usage can be seen below 👇🏻

Installation

Npm or Bower

To install the package via npm, simply run the command below

$ npm install sprogress --save
$ yarn add sprogress -S

Via CDN links

You can also make use of the cdn links if you dont want to install the package. Add the following to your html file

<script src="https://unpkg.com/[email protected]/lib/sprogress.min.js"></script>

Usage

After installing the package, you can simply make use of it by call the init function provided.

import SProgress from 'sprogress';

SProgress.init({});

The init function takes in an object which is used to customize the SProgress bar. More on that below

N.B - If you are using the CDN, you don't need to call the init method simply add the script tag and you all set 😁

Events

SProgress also triggers the scrollDistanceEvent event when the specified scrollDistanceTarget is reached by the progress bar. This can be useful if you want to display a feature to the user(maybe a newsletter modal) when they are half way into the page/article.

Event - scrollDistanceEvent

Implementation

import SProgress from 'sprogress';

SProgress.init({
	scrollDistanceTarget: 60,
});

document.addEventListener('scrollDistanceEvent', displayNewsLetterModal, {
	once: true,
});

N.B - The once object passed to the addEventListener in other to invoke the handler only once. Highly recommended if you don't want the handler trigger more than once.

Options

The following are the options that SProgress supports:-

color

String

This basically customizes the color of the progress bar.

height

Integer

This can be used to manipulates the height of the progress bar.

scrollDistanceTarget

Integer

This is used to specify a certain distance for the scrollDistanceEvent to fire.

Customization

With SProgress, the following properties can be customized:-

Color

String

  import SProgress from 'sprogress';

  SProgress.init({
    color: // Your color here in hex |rgb |rgba format
  });

Height

Integer

import SProgress from 'sprogress';

SProgress.init({
	height: 10,
});

Using Classname

The default classname for the progress bar is scroll-progress and with that you can create you very own css file and manipulate the class to best suit your needs.

.scroll-progress {
	/* CSS styles here */
}

Contributions

Looking to contribute, then

  • simply clone or fork this repo
  • create a branch for your bug-fix, feature or cleanup
  • raise a pull request
  • if deemed worthy 😁 the branch will be merged ASAP.

Issues

As they say, Software is written by humans and therefore has bugs so if you notice any bug while using the library, do raise an issue

/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                                              *
 *                                                                                              *
 *                        ____  ____                                                            *
 *                       / ___||  _ \ _ __ ___   __ _ _ __ ___  ___ ___                         *
 *                       \___ \| |_) | '__/ _ \ / _` | '__/ _ \/ __/ __|                        *
 *                        ___) |  __/| | | (_) | (_| | | |  __/\__ \__ \                        *
 *                       |____/|_|   |_|  \___/ \__, |_|  \___||___/___/                        *
 *                                              |___/                                           *
 *                                                                                              *
 *                                  Copyrights © 2019                                           *
 *                             <Author name="Daniel Eze"                                        *
 *                                url="https://twitter.com/theghostyced" />                     *
 *                                                                                              *
 *                                                                                              *
 *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */