oxjs/source/Ox.UI/js/Bar/Ox.Progressbar.js

31 lines
675 B
JavaScript
Raw Normal View History

2011-09-01 09:35:45 +00:00
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;
};