Coder Social home page Coder Social logo

numberprogressbar's Introduction

NumberProgressBar Demo

A lovely progressbar. Inspired by daimajia.

demo

To-do List

  • Support multiple number styles
    • percentage
    • numerator / denominator
    • reverse
    • negative number
    • customizable
  • Fix bug of multiple reach operations
  • Add color option

Installation

bower install NumberProgressBar [--save]

Usage

HTML
<div class="number-pb">
  <div class="number-pb-shown"></div>
  <div class="number-pb-num">0%</div>
</div>
CSS

You can refer to the file number-pb.css and make your own modifications.

.number-pb {
  position: relative;
  height: 3px;
  background-color: #ddd;
}

.number-pb .number-pb-shown {
  position: absolute;
  background-color: #176785;
  background-image: linear-gradient(to right, #176785, #499989);
  top: -1px;
  left: 0;
  height: 5px;
  -moz-box-shadow:    0 0 3px 0 #499989;
  -webkit-box-shadow: 0 0 3px 0 #499989;
  box-shadow:         0 0 3px 0 #499989;
}

.number-pb .number-pb-num {
  position: absolute;
  background-color: #fff;
  left: 0;
  top: -0.45em;
  padding: 0 5px; 
}
javaScript
var basicBar = $basic.find('.number-pb').NumberProgressBar({
  style: 'basic',
  min: A_MIN_NUMBER,
  max: A_MAX_NUMBER
})
var percentageBar = $('.number-pb').NumberProgressBar({
  style: 'percentage'  
})
var stepBar = $('.number-pb').NumberProgressBar({
  style: 'step',
  max: maxStep
})
/* For stepBar:
   min is set to 0 automatically,
   max is supposed to be > 0 */
bars.reach(dest, reachOptions);  //dest is the progress # at which you want to reach

Options

barOptions

These are the options you can configure when initializing a progressbar.

Option Default Usage
style basic [basic, percentage, step]
duration 10000 The duration (in ms) needed from 0 to 100
min 0 The min # of the progress
max 100 The max # of the progress
reverse false If true, count down progress
current 0 The initial # of the progress
shownQuery '.number-pb-shown' Your query string for the shown bar
numQuery '.number-pb-num' Your query string for the number

reachOptions

These are the options for each reach operation: bar.reach(dest, reachOptions).

Option Default Usage
duration null The duration for a reach operation.
complete null The callback when a reach operation is done.

numberprogressbar's People

Contributors

kalasoo avatar armandgrillet avatar

Stargazers

Andrew Johnson avatar  avatar 忘我思考 avatar TONy.W avatar wjh avatar Eddie Hsu avatar Gavin Xiang avatar A Z 1 B avatar Dušan Todorović avatar  avatar  avatar  avatar Yannick Gauthier avatar Calat avatar 月野兔酱 avatar  avatar Stark.Tony avatar David Yu avatar CobraDev avatar Asyraf avatar Raymond Seger avatar jaqen404 avatar Charlotte Bao avatar denghm avatar leo avatar  avatar 全栈程序员龙湫 avatar RC avatar Shah Zaib avatar ecomarine avatar YuYan avatar Gurdeep Singh (Guru) avatar Angus H. avatar 凌飏 avatar fangs avatar WenryXu avatar Xianglong Wu avatar Guanglin An avatar fred avatar Kapelius avatar armysheng avatar jibin.hou avatar Steve avatar Pranav Lathigara avatar Santiago Montoya A. avatar  avatar davidwei_001 avatar 邵彬 avatar Necros avatar Code Explore avatar Willem D'Haese avatar John Pettigrew avatar Fannie avatar  avatar Aleksandr Huz avatar Aleksandr Kukhta avatar Ronan avatar Paul Eastwood avatar Giulia Santoiemma avatar lindowx avatar Jacky Alciné avatar lllllttttt avatar tricarte avatar Rezha Julio avatar brangnu avatar lbjhk avatar Jitendra Joshi avatar Waqas Zahoor avatar Wade Zhang avatar null avatar Matt Soria avatar Sabin Tudor avatar  avatar Shon Chan avatar Rafael Lins avatar Michelle Tilley avatar Shaun Foce avatar Hu Chen avatar JIANAN.SHI avatar Guinslym avatar 九林 avatar Jason Berberich avatar Laurensius Dede Suhardiman avatar Gavin Wong avatar TheCreation avatar  avatar litten avatar Young avatar Lakatos Tibor avatar Colir avatar Michael Utz avatar Francesco Kirchhoff avatar joe avatar Vlad Vaviloff avatar Vladislav Botvin avatar Lǐ Jīng avatar Dan Denney avatar David Kewal avatar Rezha Julio avatar James avatar

Watchers

Omar Dixon avatar davidwei_001 avatar  avatar Christian Quispe H avatar  avatar Pavel Belousov avatar Jon Braam avatar  avatar

numberprogressbar's Issues

,

,

bower install error

There seems to be an error with one of your bower dependencies thats throws error bower install please check :

Velocity.js

bower Velocity.js#* ENOTFOUND Package Velocity.js not found

A working example

Hi.

Perhaps I am being a bit slow or missing the point but do you have a working example where a a predefined number is reached rather than a randomly generated one? All of the examples seem random which doesn't help me understand how to properly use it for precise values. I looks great though!

Thanks,
Nat

countdown timer

Hi, i cannot success to set the progressbar to work as countdown timer. I'd like to set up a countdown timer that start from the end (100) and the line shrink to 0 in 15sec.

 var $basic = $('#progressTimer');
 var basicBar = $basic.find('.number-pb').NumberProgressBar({
  duration: 15000,
  style: 'basic',
  min: 1,
  max: 100,
  current: 100
});

var basicLoop = function() {
  basicBar.reach(undefined, {
    duration: 15000
  });
}

basicLoop();

and if its an easiest way to trigger the function, not in 3 separated function like above.
Thank you in advance!

making dynamic

what about multiple progress bar same div but different progress values?

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.