Convert Figma logo to code with AI

usablica logoprogress.js

ProgressJs is a JavaScript and CSS3 library which help developers to create and manage progress bar for every objects on the page.

2,369
246
2,369
11

Top Related Projects

15,677

Automatically add a progress bar to your site.

26,055

For slim progress bars like on YouTube, Medium, etc

11,939

Simple javascript toast notifications

Responsive and slick progress bars

Quick Overview

Progress.js is a lightweight JavaScript library for creating and managing progress bars. It provides a simple and customizable way to add progress indicators to web applications, enhancing user experience by visually representing the completion status of various tasks or processes.

Pros

  • Easy to use and integrate into existing projects
  • Highly customizable with various styles and options
  • Lightweight and dependency-free
  • Supports multiple progress bars on a single page

Cons

  • Limited documentation and examples
  • Not actively maintained (last update was in 2017)
  • Lacks advanced features like animations or complex progress patterns
  • No built-in support for responsive design

Code Examples

Creating a basic progress bar:

var progressBar = new ProgressBar({
    target: '#myProgress',
    value: 50
});

Customizing the progress bar appearance:

var customProgressBar = new ProgressBar({
    target: '#customProgress',
    value: 75,
    color: '#3498db',
    height: '10px',
    showPercentage: true
});

Updating the progress bar value:

progressBar.setValue(80);

Getting Started

  1. Include the Progress.js library in your HTML file:
<script src="https://cdn.jsdelivr.net/npm/progressjs@1.1.0/progress.min.js"></script>
  1. Create a target element in your HTML:
<div id="myProgress"></div>
  1. Initialize and use the progress bar in your JavaScript:
document.addEventListener('DOMContentLoaded', function() {
    var progressBar = new ProgressBar({
        target: '#myProgress',
        value: 0
    });

    // Simulate progress
    var progress = 0;
    var interval = setInterval(function() {
        progress += 10;
        progressBar.setValue(progress);
        if (progress >= 100) {
            clearInterval(interval);
        }
    }, 1000);
});

This example creates a progress bar that automatically increases by 10% every second until it reaches 100%.

Competitor Comparisons

15,677

Automatically add a progress bar to your site.

Pros of pace

  • More comprehensive and feature-rich, offering automatic progress tracking for Ajax requests, elements, and document loading
  • Provides a variety of themes and customization options out-of-the-box
  • Actively maintained with regular updates and a larger community

Cons of pace

  • Larger file size and potentially higher overhead due to its extensive features
  • May be overkill for simple progress bar needs
  • Less flexibility for creating custom progress indicators from scratch

Code comparison

progress.js:

var progressBar = new ProgressBar({
  target: '#progress-bar',
  size: 200,
  percentage: 50
});

pace:

Pace.start();
// Automatically tracks progress; no manual configuration required

Summary

progress.js is a lightweight library focused solely on creating progress bars, offering simplicity and ease of use for basic needs. It provides more control over the creation and manipulation of progress indicators.

pace, on the other hand, is a more comprehensive solution that automatically tracks progress for various scenarios, including Ajax requests and page loads. It offers pre-built themes and requires minimal configuration but may be excessive for simple use cases.

The choice between the two depends on the specific requirements of your project, with progress.js being better suited for lightweight, custom progress bars, and pace offering a more robust, automatic solution for overall page load progress tracking.

26,055

For slim progress bars like on YouTube, Medium, etc

Pros of nprogress

  • More actively maintained with recent updates
  • Offers additional customization options (e.g., spinner, custom parent container)
  • Includes built-in support for showing progress during AJAX requests

Cons of nprogress

  • Slightly larger file size (3.5KB vs 2KB for progress.js)
  • Less straightforward API for basic usage compared to progress.js
  • Requires additional setup for non-AJAX progress tracking

Code Comparison

nprogress:

NProgress.start();
NProgress.set(0.4);
NProgress.inc();
NProgress.done();

progress.js:

var progressBar = new ProgressBar();
progressBar.setPercent(50);
progressBar.increase(25);
progressBar.end();

Both libraries provide similar functionality for creating progress bars, but nprogress offers more advanced features and customization options. progress.js has a simpler API and smaller file size, making it suitable for basic use cases. nprogress is better suited for projects requiring more complex progress tracking, especially for AJAX requests. The choice between the two depends on the specific needs of your project and the level of customization required.

11,939

Simple javascript toast notifications

Pros of toastr

  • More versatile notification types (success, info, warning, error)
  • Extensive customization options for appearance and behavior
  • Better browser compatibility and responsive design

Cons of toastr

  • Larger file size and potentially higher performance overhead
  • Steeper learning curve due to more configuration options
  • Less focused on progress indication specifically

Code Comparison

toastr:

toastr.options = {
  "closeButton": true,
  "progressBar": true
};
toastr.success('Hello World!');

progress.js:

var progressBar = new ProgressBar({
  target: '#progress-bar',
  size: 100,
  percentage: 75
});
progressBar.show();

Summary

toastr is a more comprehensive notification library with various types of alerts and extensive customization options. It's well-suited for applications requiring diverse user feedback. progress.js, on the other hand, is more focused on progress indication, offering a simpler API for creating progress bars.

toastr provides a richer set of features but may be overkill for projects only needing progress indicators. progress.js is lighter and more straightforward for progress bar implementation but lacks the versatility of toastr for other notification types.

Choose toastr for diverse notification needs and extensive customization, or progress.js for a lightweight, focused progress bar solution.

Responsive and slick progress bars

Pros of progressbar.js

  • More customizable and flexible, offering various shapes and styles
  • Smoother animations with better performance
  • Active development and maintenance

Cons of progressbar.js

  • Larger file size and potentially more complex to implement
  • Requires SVG support, which may not be available in older browsers

Code Comparison

progress.js:

var progressBar = new ProgressBar('myProgressBar');
progressBar.setOptions({
  color: '#0080FF',
  height: '10px'
});
progressBar.set(50);

progressbar.js:

var bar = new ProgressBar.Line('#container', {
  strokeWidth: 4,
  easing: 'easeInOut',
  duration: 1400,
  color: '#FFEA82',
  trailColor: '#eee',
  trailWidth: 1,
  svgStyle: {width: '100%', height: '100%'}
});
bar.animate(0.5);

The code comparison shows that progressbar.js offers more customization options and a more flexible API, allowing for different shapes and styles. However, it also requires more configuration, which may increase complexity for simple use cases. progress.js provides a simpler API with fewer options, making it easier to implement for basic progress bars but limiting advanced customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ProgressJS

ProgressJs is a JavaScript and CSS3 library which helps developers create and manage progress bars for every object on the page.

How To Use

  1. Include progress.js and progressjs.css in the page (use the minified version from minified folder for production)

  2. Execute the following JavaScript code in the page:

//to set progress-bar for whole page
progressJs().start();
//or for specific element
progressJs("#targetElement").start();

Use other methods to increase, decrease or set an auto-increase function for your progress-bar. Furthermore, you can change the template using setOption method.

API

Check the API and method usage with example here: https://github.com/usablica/progress.js/wiki/API

Build

First, you should install nodejs and npm, then run this command: npm install to install all dependencies.

Now you can run this command to minify all the static resources:

make build

Roadmap

  • Add example folder and provide examples
  • More browser compatibility + mobile/tablet device support
  • Add more templates

Release History

  • v0.1.0 - 2014-02-14
    • First version
    • Increase, decrease and auto-increase functions
    • Ability to design and add templates

Author

Afshin Mehrabani

License

Copyright (C) 2012 Afshin Mehrabani (afshin.meh@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.