Material Progress —Google Material Design Progress linear bar. By using CSS3 and vanilla JavaScript.

Overview

MProgress.js

Google Material Design Progress Linear bar.

It uses CSS3 and vanilla JavaScript which doesn't depend on any other libraries.

Types and preview

Type 1. Determinate

Type 2. Buffer

Type 3. Indeterminate

Type 4. Query Indeterminate and Determinate

Or you can see all types together:

Vedio:Material Progress & activity

DEMO

See the Online demo

How to start

Install it

Include mprogress.min.js and mprogress.min.css in your target html file.

<link rel='stylesheet' href='mprogress.min.css'/>

<script src='mprogress.min.js'></script>

You can also install it via Bower or npm:

bower install --save mprogress
npm install --save mprogress

Basic usage

Example for the Determinate type

1.Instantiation:

var mprogress = new Mprogress();

2.Show and start the bar by using:

mprogress.start();

Or you can just use the following code to replace step 1 and 2:

var mprogress = new Mprogress('start');  //start it immediately

3.Finish the loading and hide it :

mprogress.end();

Advanced usage

All types have start and end methods.

Type1: Determinate

Determinate also has set and inc methods.

set(n)

Sets the progress bar status, where n is a number from 0.0 to 1.0.

eg:

mprogress.set(0.3);
inc()

Increases by a random amount.

eg:

mprogress.inc(); // Increase the bar with a random amount.
mprogress.inc(0.3); // This will get the current status value and adds 0.3 until status is 0.994

Type2: Buffer

Its always used for video loading, and you can use for other case.

Init Type Buffer :

var bufferIntObj = {
  template: 2
};
var bufferProgress = new Mprogress(bufferIntObj);
Start it:
bufferProgress.start();

If you want to start it immediately after instantiating it,you can use:

var bufferIntObj = {
  template: 2, // type number
  start: true  // start it now
};
var bufferProgress = new Mprogress(bufferIntObj);
End it:
bufferProgress.end();

Buffer also has set , inc and setBuffer methods

Type Buffer has two progress: main progress and buffer progress.

set(n)

Sets the main progress bar status (0,1)

setBuffer(num)

Sets the buffer progress bar status (0,1)

inc()

Increases by a random amount, including buffer bar.

Type3:Indeterminate

Init Type Indeterminate :

var intObj = {
  template: 3, 
  parent: '#customId' // this option will insert bar HTML into this parent Element 
};
var indeterminateProgress = new Mprogress(intObj);

Type Indeterminate just has start and end methods.

indeterminateProgress.start();

indeterminateProgress.end();

Type4:Query Indeterminate and Determinate

Init Type Query :

var intObj = {
  template: 4,
  parent: '#anothercustomId' // to other position
};
var queryProgress = new Mprogress(intObj);

Type Query just has start and end methods.

queryProgress.start();

queryProgress.end();

Configuration

Passing an object(configuration) to instantiated Mprogress

var mp = new Mprogress(configuration);

template

Set the progress bar type. (default: 1)

var mp = new Mprogress({
  // vaule { 
  //    1: Type Determinate,
  //    2: Buffer,
  //    3: Indeterminate, 
  //    4: Query,
  //  '<div>...</div>': 'yourcustomHTML'
  // }
  template: 2 
});

parent

Change the parent container where the bar is shown. (default: body)

var mp = new Mprogress({
  parent: '#customContainer' 
});

start

Start the bar immediately. (default: false)

var mp = new Mprogress({
  template: 4,
  start: true
});

For type1 Determinate, you can just use:

var mp = new Mprogress('start');

Advanced Configuration

trickle

trickleRate

trickleSpeed

minimum

easing

positionUsing

speed

Browser Support

Mobile First.

All types work in Chrome and Firefox.

Type Determinate works in all browsers.

License

MIT © gctang

Comments
  • Allow multiple instances with the same template option on the same page

    Allow multiple instances with the same template option on the same page

    fix(_getRenderedId): include options.parent when computing the idName - similar to getting a unique cache id, allows to have multiple instances of the same type, using the same template, running on the same page simultaneously;

    screen shot 2015-06-23 at 19 40 27

    opened by lazabogdan 1
  • Remove moot `version` property from bower.json

    Remove moot `version` property from bower.json

    Per bower/bower.json-spec@a325da3

    Also their maintainer says they probably won't ever use it: http://stackoverflow.com/questions/24844901/bowers-bower-json-file-version-property

    opened by kkirsche 1
  • typo

    typo

    hey @lightningtgc

    nice project. guess you meant build not bulid? it's all over in your gulpfile

    https://github.com/lightningtgc/MProgress.js/blob/master/gulpfile.js#L11

    cheers stephan

    opened by minddust 1
  • Update main.js

    Update main.js

    Currently there's no way to end a progress loader instantly, say for example the parent element gets removed before the speed delay completes, it will throw an error at Utils.setcss because there's no element to set the values to. Additionally subsequent calls trying to initialize MProgress fail from the previous errors.

    It's very annoying to integrate into Frameworks like Angular that remove elements without warning. This update simply ignores the DOM element references if they don't exist.

    opened by maruf89 0
  • Two instance at the same time?

    Two instance at the same time?

    When I try to use two instance of MProgress.js, both of them did not show up. There something did I wrong? Or it doesn't support two instance in same page at this time?

    opened by ankanch 1
  • Cleanup Package.json

    Cleanup Package.json

    Fixes the issue with some bad characters in package.json ( https://github.com/lightningtgc/MProgress.js/issues/14 ) and also puts an entry point into the package for use with webpack ( https://github.com/lightningtgc/MProgress.js/issues/16 ).

    opened by edave 1
  • Add main entrypoint to package.json

    Add main entrypoint to package.json

    At the moment, if you execute require("mprogress") in node, the error Error: Cannot find module 'mprogress' is produced. Adding a main entry in package.json will fix this

    opened by ThomasHickman 2
  • Project still active?

    Project still active?

    @lightningtgc is this project still actively maintained? Looks like the changes over the past year or so haven't been released yet, so just curious. Thanks!

    opened by atdiff 0
  • package.json contains bad characters

    package.json contains bad characters

    $ cat -A node_modules/mprogress/package.json
    M-oM-;M-?{$
      "name": "mprogress",$
      "description": "Mprogress.js creates progress linear bar from Google Material Design.",$
      "version": "0.1.1",$
      "homepage": "https://github.com/lightningtgc/MProgress.js",$
      "author": "tang guichuan <[email protected]>",$
      "repository": {$
        "type": "git",$
        "url": "git://github.com/lightningtgc/MProgress.js.git"$
      },  $
      "devDependencies": {$
        "gulp": "^3.8.10",$
        "del": "^1.1.1",$
        "gulp-uglify": "^1.1.0",$
        "gulp-rename": "^1.2.0",$
        "gulp-es6-module-transpiler": "^0.2.1",$
        "gulp-stylus": "^2.0.0",$
        "gulp-minify-css": "^0.4.5"$
      }$
    }$
    

    M-oM-;M-? this is bad

    Webpack fails with this package.json

    opened by fehergeri13 1
Releases(v0.1.1)
Automatically add a progress bar to your site.

PACE An automatic web page progress bar. Demo Documentation Include pace.js and the theme css of your choice on your page (as early as is possible), a

null 15.5k Jan 8, 2023
Responsive and slick progress bars

ProgressBar.js Responsive and slick progress bars with animated SVG paths. Use built-in shapes or create your own paths. Customize the animations as y

Kimmo Brunfeldt 7.7k Jan 8, 2023
Very lightweight progress bars. No jQuery

Very lightweight progress bars (~699 bytes gzipped). Compatibility: iE7+ and the rest of the world Demo See nanobar.jacoborus.codes Installation Downl

Jacobo Tabernero 2.9k Dec 19, 2022
Modern ways of revealing new content using SVG animations.

Page Loading Effects Modern ways of revealing new content using SVG animations. Article on Codrops Demo Integrate or build upon it for free in your pe

Codrops 635 Dec 30, 2022
Convert a CSS linear gradient function to expo-linear-gradient props

@bacons/css-to-expo-linear-gradient Demo: snack Convert a CSS linear gradient function to expo-linear-gradient props. Add the package to your npm depe

Evan Bacon 15 Dec 15, 2022
ProgressJs is a JavaScript and CSS3 library which help developers to create and manage progress bar for every objects on the page.

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

usablica 2.4k Dec 30, 2022
Multi Upload with Progress Bar in Vanilla JS

js-progress-bar-multi-upload Multi Upload with Progress Bar in Vanilla JS Youtube dersinde birlikte hazırladığımız çoklu progress barlı javascript upl

Tayfun Erbilen 11 Jun 10, 2022
Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

Material-UI Quickly build beautiful React apps. Material-UI is a simple and customizable component library to build faster, beautiful, and more access

Material-UI 83.6k Dec 30, 2022
This plugin for Chart.js that makes your bar chart to 100% stacked bar chart.

chartjs-plugin-stacked100 This plugin for Chart.js that makes your bar chart to 100% stacked bar chart. Requires Chart.js 3.x. Demo: https://y-takey.g

y-take 106 Jan 3, 2023
Super lighweight, pure JavaScript page load progress bar

Nanobar Super lighweight, pure JavaScript page load progress bar Status View Preview Table of contents Status Quick Start What's included Bugs and fea

The MUDA Organization 5 Jan 3, 2022
CLI Progress Bar implemented in NodeJS to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code

NodeJS-ProgressBar CLI Progress Bar for NodeJS and JavaScript to track Time, ETA and Steps for any long running jobs in any loops in JS, NodeJS code D

Atanu Sarkar 5 Nov 14, 2022
Automatically add a progress bar to your site.

PACE An automatic web page progress bar. Demo Documentation Include pace.js and the theme css of your choice on your page (as early as is possible), a

null 15.5k Jan 8, 2023
Creates a button that turns into a progress bar with a elastic effect. Based on the Dribbble shot "Download" by xjw

Elastic Progress Creates a button that turns into a progress bar with a elastic effect. Based on a Dribbble shot by xjw. By Lucas Bebber. Article on C

Codrops 876 Jan 1, 2023
A progress bar plugin for Vite.

vite-plugin-progress Display with progress bar when building ?? Install npm i vite-plugin-progress -D # yarn yarn add vite-plugin-progress -D # pn

Jeddy Gong 137 Dec 17, 2022
A progress bar plugin for tasks in Obsidian.

Obsidian Task Progress Bar A plugin for showing task progress bar near the tasks bullet or headings. Only works in Live Preview mode in Obsidian. Sett

Boninall 52 Dec 31, 2022
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system

Sphinx-Immaterial Theme This theme is an adaptation of the popular mkdocs-material theme for the Sphinx documentation tool. This theme is regularly ma

Jeremy Maitin-Shepard 89 Jan 4, 2023
A set of React components implementing Google's Material Design specification with the power of CSS Modules

React Toolbox is a set of React components that implement Google's Material Design specification. It's powered by CSS Modules and harmoniously integra

React Toolbox 8.7k Dec 30, 2022