A quick-and-dirty loading bar for use in your larger demos.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE.md
README.md
index.js
package.json

README.md

loading-bar experimental

loading bar

A quick-and-dirty loading bar for use in your larger demos.

Usage

loading-bar

require('loading-bar')([fill, width, height, border])

Creates a new loading bar element, ready to be attached to the DOM. All arguments are optional:

  • fill: the color of the loading bar, as a CSS string. Defaults to #fff
  • width: the width of the loading bar in pixels. Defaults to 500
  • height: the height of the loading bar in pixels. Defaults to 30
  • border: the size of the inner and outer border in pixels. Defaults to 4.

bar.append([parent])

Appends the loading bar to parent, which defaults to document.body.

bar.update(t)

Pass a value between 0 and 1 to this function to update the progress of the loading bar.

bar.remove()

Removes the bar from the DOM.

bar.fadeout([duration])

Fades the loading bar out over duration milliseconds. Defaults to 1 second.

License

MIT. See LICENSE.md for details.