jquery.lineProgressbar.js
1.3 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
/**
* jQuery Line Progressbar
* Author: KingRayhan<rayhan095@gmail.com>
* Author URL: http://rayhan.info
* Version: 1.0.0
*/
(function($){
'use strict';
$.fn.LineProgressbar = function(options){
var options = $.extend({
percentage : null,
ShowProgressCount: true,
duration: 1000,
// Styling Options
fillBackgroundColor: '#3498db',
backgroundColor: '#EEEEEE',
radius: '0px',
height: '10px',
width: '100%'
},options);
return this.each(function(index, el) {
// Markup
$(el).html('<div class="progressbar"><div class="proggress"></div><div class="percentCount"></div></div>');
var progressFill = $(el).find('.proggress');
var progressBar= $(el).find('.progressbar');
progressFill.css({
backgroundColor : options.fillBackgroundColor,
height : options.height,
borderRadius: options.radius
});
progressBar.css({
width : options.width,
backgroundColor : options.backgroundColor,
borderRadius: options.radius
});
// Progressing
progressFill.animate(
{
width: options.percentage + "%"
},
{
step: function(x) {
if(options.ShowProgressCount){
$(el).find(".percentCount").text(Math.round(x) + "%");
}
},
duration: options.duration
}
);
////////////////////////////////////////////////////////////////////
});
}
})(jQuery);