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 = $('
').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; };