-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery-css-progress-bar.js
More file actions
38 lines (32 loc) · 1002 Bytes
/
jquery-css-progress-bar.js
File metadata and controls
38 lines (32 loc) · 1002 Bytes
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
(function ($) {
var methods = {
init : function (options) {
var applied = this.data("cssProgressBar");
if (applied) {
return this;
}
this.data("cssProgressBar", true);
this.addClass("ui-progress-bar");
this.addClass("ui-container");
this.addClass("transition");
var progressDiv = document.createElement('div');
progressDiv.setAttribute("class", "ui-progress");
progressDiv.setAttribute("style", "width: 0%;");
this.append(progressDiv);
return this;
},
update : function (perc) {
this.children().css("width", perc + "%");
return this;
}
};
$.fn.cssProgressBar = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.cssProgressBar');
}
};
})(jQuery);