9 * @class Roo.bootstrap.Navbar
10 * @extends Roo.bootstrap.Component
11 * Bootstrap Navbar class
12 * @cfg {Boolean} sidebar has side bar
13 * @cfg {Boolean} bar is a bar?
14 * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
15 * @cfg {String} brand what is brand
16 * @cfg {Boolean} inverse is inverted color
17 * @cfg {String} type (nav | pills | tabs)
18 * @cfg {Boolean} arrangement stacked | justified
19 * @cfg {String} align (left | right) alignment
20 * @cfg {String} brand_href href of the brand
21 * @cfg {Boolean} main (true|false) main nav bar? default false
22 * @cfg {Boolean} loadMask (true|false) loadMask on the bar
27 * @param {Object} config The config object
31 Roo.bootstrap.Navbar = function(config){
32 Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
36 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
55 getAutoCreate : function(){
60 if (this.sidebar === true) {
68 if (this.bar === true) {
82 'data-toggle': 'collapse',
87 html: 'Toggle navigation'
107 cls: 'collapse navbar-collapse'
112 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
114 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
115 cfg.cls += ' navbar-' + this.position;
116 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
119 if (this.brand !== '') {
122 href: this.brand_href ? this.brand_href : '#',
131 cfg.cls += ' main-nav';
137 } else if (this.bar === false) {
140 Roo.log('Property \'bar\' in of Navbar must be either true or false')
150 if (['tabs','pills'].indexOf(this.type)!==-1) {
151 cfg.cn[0].cls += ' nav-' + this.type
153 if (this.type!=='nav') {
154 Roo.log('nav type must be nav/tabs/pills')
156 cfg.cn[0].cls += ' navbar-nav'
159 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
160 cfg.cn[0].cls += ' nav-' + this.arrangement;
163 if (this.align === 'right') {
164 cfg.cn[0].cls += ' navbar-right';
167 cfg.cls += ' navbar-inverse';
175 initEvents :function ()
177 //Roo.log(this.el.select('.navbar-toggle',true));
178 this.el.select('.navbar-toggle',true).on('click', function() {
180 this.el.select('.navbar-collapse',true).toggleClass('in');
188 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
190 var size = this.el.getSize();
191 this.maskEl.setSize(size.width, size.height);
192 this.maskEl.enableDisplayMode("block");
201 getChildContainer : function()
203 if (this.bar === true) {
204 return this.el.select('.collapse',true).first();
221 register : function(item)
223 this.navItems[item.tabId] = item;
224 item.navId = navbar.navId;
229 Roo.apply(Roo.bootstrap.Navbar, {
233 register : function(navbar)
235 bars[navbar.navId] = navbar;