Fork me on GitHub
ToProgress
A lightweight, no-dependency top bar library
Download v0.1.1 (2.2 KB)

Quick Look

.increase(15).decrease(15).reset().finish().show().hide().setProgress(30)

Usage

0. Import script

<script src="path/to/ToProgress.min.js"></script>

1. Set options (The values below are default value)

var options = {
 id: 'top-progress-bar',
 color: '#F44336', 
 height: '2px', 
 duration: 0.2
}

2. Get the progress bar instance

var progressBar = new ToProgress(options);

3. Play it!

progressBar.increase(20);

API

new ToProgress(options[,selector])

  • options
    • id - the id of auto-created top bar element
    • color - top bar color
    • height - top bar height
    • duration - increase duration (seconds)
  • selector - valid css selector, if is defined, topbar will put on the top of the element. Only find the first element.

.increase(progress[,callback])

  • progress- percentage number

.decrease(progress[,callback])

  • progress- percentage number

.setProgress(progress[,callback])

  • progress- percentage number

.reset([,callback])

.finish([,callback])

.getProgress()

.show()

.hide()