-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathjquery.progressbar.js
52 lines (46 loc) · 1.27 KB
/
jquery.progressbar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*!
* jQuery Progress Bar
* version: 1.0.0
* @requires jQuery v1.6 or later
* Copyright (c) 2013 Ravishanker Kusuma
* http://hayageek.com/
*/
(function ($) {
$.fn.progressbar = function (options)
{
var settings = $.extend({
width:'300px',
height:'25px',
color:'#0ba1b5',
padding:'0px',
border:'1px solid #ddd'},options);
//Set css to container
$(this).css({
'width':settings.width,
'border':settings.border,
'border-radius':'5px',
'overflow':'hidden',
'display':'inline-block',
'padding': settings.padding,
'margin':'0px 10px 5px 5px'
});
// add progress bar to container
var progressbar =$("<div></div>");
progressbar.css({
'height':settings.height,
'text-align': 'right',
'vertical-align':'middle',
'color': '#fff',
'width': '0px',
'border-radius': '3px',
'background-color': settings.color
});
$(this).append(progressbar);
this.progress = function(value)
{
var width = $(this).width() * value/100;
progressbar.width(width).html(value+"% ");
}
return this;
};
}(jQuery));