Coder Social home page Coder Social logo

circular-progress-bar's Introduction

circular-progress-bar

A javascript circular progress bar widget. The widget utilizes jQuery, although it's not written in the traditional jQuery plugin style. To use, create an instance via the init function (which acts as an object factory):

progBar = circularProgressBar.init(radius, width, $container, activeColor, inactiveColor, innerColor, initalPercentage);
  • radius - the radius of the progress bar
  • width - the width of the progress bar
  • $container - the containing element the progress bar will be appended to
  • activeColor - the color of the active part of the progress bar. This is the part that will move as the bar progresses.
  • inactiveColor - the 'matte' of the progress bar. This is the part of the progress bar behind the active color (i.e. when the progress is 0 - this part is 100% visible).
  • innerColor - this is the color of the inner "hollow" part of the progress bar. The idea is to set this to you page background color. This is bit of a gotcha! if you ever wanted to put the progress bar on a non-solid color background.
  • initalPercentage - the initial progress percentage (0-100) of the bar

For example:

progBar = circularProgressBar.init(150, 20, $('#progBarContainer'), 'orange', 'green', '#fff', 25);

The following method is available to your instance:

  • progBar.setValue( val ) - set the progress percentage (0 - 100).

For example:

progBar.setValue(63);

Gotchas!

The progress bar requires inline svg support. Of note, this is absent in IE8 and lower. You're probably going to want to detect the support and use an alternate progress bar if the support is lacking.

For example, if using Modernizer:

if (Modernizr.inlinesvg) {
    progBar = circularProgressBar.init(150, 20, $('#progBarContainer'), 'orange', 'green', '#fff', 25);
} else {
    // Need to user a different progress bar / spinner
}

circular-progress-bar's People

Contributors

rmisio avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.