31 lines
675 B
JavaScript
31 lines
675 B
JavaScript
|
Ox.Progressbar = function(options, self) {
|
||
|
|
||
|
self = self || {};
|
||
|
var that = Ox.Element({}, self)
|
||
|
.defaults({
|
||
|
progress: 0,
|
||
|
width: 256
|
||
|
})
|
||
|
.options(options || {})
|
||
|
.addClass('OxProgressbar')
|
||
|
.css({width: self.options.width});
|
||
|
|
||
|
self.$progress = $('<div>').appendTo(that);
|
||
|
|
||
|
setProgress();
|
||
|
|
||
|
function setProgress() {
|
||
|
self.$progress.css({
|
||
|
width: Math.round(16 + self.options.progress * (self.options.width - 16)) + 'px'
|
||
|
});
|
||
|
}
|
||
|
|
||
|
self.setOption = function(key, value) {
|
||
|
if (key == 'progress') {
|
||
|
setProgress();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return that;
|
||
|
|
||
|
};
|