new MooProgressBar($('my_bar_container')); /* simple case */
new MooProgressBar($('my_bar_container2'),{ /* simple upload progress */
range:654,
unit:'kB',
precision:2
});
/* Access the Instance via the element's storage */
$('my_bar_container2').retrieve('MooProgressBar').setValue(25);
The getLabel option defaults to:
function(progress, value, unit, precision){
if (unit=='%'){
return progress.toFixed(parseInt(precision))+unit;
}else{
return value.toFixed(parseInt(precision))+unit;
}
}
Will fire when the progress property was changed
signature:
onProgress(progress,value,unit,precision)
Will fire when the progress reached 100%
signature:
onComplete(value,unit,precision)
Set the current value of the bar
signature:
setValue(value,no_anim)
Arguments:
Get the current value of the bar
signature:
getValue()
Set the current progress of the bar in percent
signature:
setProgress(progress,no_anim)
Arguments:
Get the current value of the bar
signature:
getProgress()
Set the current progress of the bar in percent
signature:
setLabel(text)
Arguments:
For a good result, you can use, for example, the following HTML structure:
<div class="progressbar"> <!-- Main container -->
<div class="progressbar_inner"> <!-- The bar, this is resized -->
<div class="progressbar_label"></div> <!-- The bottom label -->
<div class="progressbar_bg"> <!-- The bar background, this is what you see growing -->
<div class="progressbar_label"></div> <!-- The top label -->
</div>
</div>
</div>
add some css:
.progressbar{
width:160px;
height:24px;
border:1px solid black;
overflow:hidden;
white-space:nowrap;
font-size:small;
text-align:center;
line-height:24px;
display:inline-block;
}
.progressbar_inner{
width:0;
height:100%;
position:relative; /* This is important! */
}
/* The visual bar */
.progressbar_bg{
position:absolute;
top:0;
width:100%;
height:100%;
background-color:darkcyan;
overflow:hidden
}
/* The labels */
.progressbar_label{
position:relative;
width:100%;
overflow:visible;
padding:0 4px;
}
/* The bottom label */
.progressbar_inner > .progressbar_label{
color:black;
}
/* The top label */
.progressbar_bg > .progressbar_label{
color:white;
}
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus