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);
38 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
57 getAutoCreate : function(){
65 if (this.sidebar === true) {
73 if (this.bar === true) {
75 tag: this.nav || 'nav',
87 'data-toggle': 'collapse',
92 html: 'Toggle navigation'
112 cls: 'collapse navbar-collapse'
117 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
119 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
120 cfg.cls += ' navbar-' + this.position;
122 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
125 if (this.brand !== '') {
128 href: this.brand_href ? this.brand_href : '#',
137 cfg.cls += ' main-nav';
143 } else if (this.bar === false) {
146 Roo.log('Property \'bar\' in of Navbar must be either true or false')
155 this.type = this.type || 'nav';
156 if (['tabs','pills'].indexOf(this.type)!==-1) {
157 cfg.cn[0].cls += ' nav-' + this.type
159 if (this.type!=='nav') {
160 Roo.log('nav type must be nav/tabs/pills')
162 cfg.cn[0].cls += ' navbar-nav'
165 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
166 cfg.cn[0].cls += ' nav-' + this.arrangement;
170 if (this.align === 'right') {
171 cfg.cn[0].cls += ' navbar-right';
175 cfg.cls += ' navbar-inverse';
183 initEvents :function ()
185 //Roo.log(this.el.select('.navbar-toggle',true));
186 this.el.select('.navbar-toggle',true).on('click', function() {
188 this.el.select('.navbar-collapse',true).toggleClass('in');
196 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
198 var size = this.el.getSize();
199 this.maskEl.setSize(size.width, size.height);
200 this.maskEl.enableDisplayMode("block");
209 getChildContainer : function()
211 if (this.bar === true) {
212 return this.el.select('.collapse',true).first();