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
23 * @cfg {String} tag (header|footer|nav|div) default is nav
28 * @param {Object} config The config object
32 Roo.bootstrap.Navbar = function(config){
33 Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
37 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
56 getAutoCreate : function(){
64 if (this.sidebar === true) {
72 if (this.bar === true) {
74 tag: this.nav || 'nav',
86 'data-toggle': 'collapse',
91 html: 'Toggle navigation'
111 cls: 'collapse navbar-collapse'
116 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
118 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
119 cfg.cls += ' navbar-' + this.position;
121 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
124 if (this.brand !== '') {
127 href: this.brand_href ? this.brand_href : '#',
136 cfg.cls += ' main-nav';
142 } else if (this.bar === false) {
145 Roo.log('Property \'bar\' in of Navbar must be either true or false')
154 this.type = this.type || 'nav';
155 if (['tabs','pills'].indexOf(this.type)!==-1) {
156 cfg.cn[0].cls += ' nav-' + this.type
158 if (this.type!=='nav') {
159 Roo.log('nav type must be nav/tabs/pills')
161 cfg.cn[0].cls += ' navbar-nav'
164 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
165 cfg.cn[0].cls += ' nav-' + this.arrangement;
169 if (this.align === 'right') {
170 cfg.cn[0].cls += ' navbar-right';
174 cfg.cls += ' navbar-inverse';
182 initEvents :function ()
184 //Roo.log(this.el.select('.navbar-toggle',true));
185 this.el.select('.navbar-toggle',true).on('click', function() {
187 this.el.select('.navbar-collapse',true).toggleClass('in');
195 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
197 var size = this.el.getSize();
198 this.maskEl.setSize(size.width, size.height);
199 this.maskEl.enableDisplayMode("block");
208 getChildContainer : function()
210 if (this.bar === true) {
211 return this.el.select('.collapse',true).first();