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

28 lines
956 B
JavaScript
Raw Normal View History

2011-11-05 16:46:53 +00:00
'use strict';
2011-05-16 08:24:46 +00:00
/*@
Ox.Bar <f:Ox.Element> Bar
() -> <o> Bar object
(options) -> <o> Bar object
(options, self) -> <o> Bar object
options <o> Options object
orientation <s|horizontal>
size <s|medium> can be small, medium, large or number
self <o> Shared private variable
@*/
2011-04-22 22:03:10 +00:00
Ox.Bar = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
2011-04-22 22:03:10 +00:00
.defaults({
orientation: 'horizontal',
2012-01-02 08:25:34 +00:00
size: 'medium'
2011-04-22 22:03:10 +00:00
})
.options(options || {})
.addClass('OxBar Ox' + Ox.toTitleCase(self.options.orientation)),
dimensions = Ox.UI.DIMENSIONS[self.options.orientation];
2012-01-02 08:25:34 +00:00
self.options.size = Ox.isString(self.options.size)
? Ox.UI.getBarSize(self.options.size) : self.options.size;
2011-04-22 22:03:10 +00:00
that.css(dimensions[0], '100%')
.css(dimensions[1], self.options.size + 'px');
return that;
};