9 * @class Roo.bootstrap.Navbar
10 * @extends Roo.bootstrap.Component
11 * Bootstrap Navbar class
12 * @cfg {Boolean} bar is a bar?
13 * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
14 * @cfg {String} brand what is brand
15 * @cfg {Boolean} inverse is inverted color
16 * @cfg {String} type (nav | pills | tabs)
17 * @cfg {Boolean} arrangement stacked | justified
18 * @cfg {String} align (left | right) alignment
19 * @cfg {String} brand_href href of the brand
20 * @cfg {Boolean} main (true|false) main nav bar? default false
21 * @cfg {Boolean} loadMask (true|false) loadMask on the bar
22 * @cfg {String} tag (header|footer|nav|div) default is nav
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(){
63 if (this.sidebar === true) {
71 if (this.bar === true) {
73 tag: this.nav || 'nav',
85 'data-toggle': 'collapse',
90 html: 'Toggle navigation'
110 cls: 'collapse navbar-collapse'
115 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
117 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
118 cfg.cls += ' navbar-' + this.position;
120 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
123 if (this.brand !== '') {
126 href: this.brand_href ? this.brand_href : '#',
135 cfg.cls += ' main-nav';
141 } else if (this.bar === false) {
144 Roo.log('Property \'bar\' in of Navbar must be either true or false')
153 this.type = this.type || 'nav';
154 if (['tabs','pills'].indexOf(this.type)!==-1) {
155 cfg.cn[0].cls += ' nav-' + this.type
157 if (this.type!=='nav') {
158 Roo.log('nav type must be nav/tabs/pills')
160 cfg.cn[0].cls += ' navbar-nav'
163 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
164 cfg.cn[0].cls += ' nav-' + this.arrangement;
168 if (this.align === 'right') {
169 cfg.cn[0].cls += ' navbar-right';
173 cfg.cls += ' navbar-inverse';
181 initEvents :function ()
183 //Roo.log(this.el.select('.navbar-toggle',true));
184 this.el.select('.navbar-toggle',true).on('click', function() {
186 this.el.select('.navbar-collapse',true).toggleClass('in');
194 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
196 var size = this.el.getSize();
197 this.maskEl.setSize(size.width, size.height);
198 this.maskEl.enableDisplayMode("block");
207 getChildContainer : function()
209 if (this.bar === true) {
210 return this.el.select('.collapse',true).first();