forked from 0x2620/oxjs
add Ox.Progressbar
This commit is contained in:
parent
90e795d194
commit
2a9053a588
4 changed files with 50 additions and 1 deletions
31
source/Ox.UI/js/Bar/Ox.Progressbar.js
Normal file
31
source/Ox.UI/js/Bar/Ox.Progressbar.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
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;
|
||||
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue