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);
37 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
56 getAutoCreate : function(){
61 if (this.sidebar === true) {
69 if (this.bar === true) {
83 'data-toggle': 'collapse',
88 html: 'Toggle navigation'
108 cls: 'collapse navbar-collapse'
113 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
115 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
116 cfg.cls += ' navbar-' + this.position;
118 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
121 if (this.brand !== '') {
124 href: this.brand_href ? this.brand_href : '#',
133 cfg.cls += ' main-nav';
139 } else if (this.bar === false) {
142 Roo.log('Property \'bar\' in of Navbar must be either true or false')
151 this.type = this.type || 'nav';
152 if (['tabs','pills'].indexOf(this.type)!==-1) {
153 cfg.cn[0].cls += ' nav-' + this.type
155 if (this.type!=='nav') {
156 Roo.log('nav type must be nav/tabs/pills')
158 cfg.cn[0].cls += ' navbar-nav'
161 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
162 cfg.cn[0].cls += ' nav-' + this.arrangement;
166 if (this.align === 'right') {
167 cfg.cn[0].cls += ' navbar-right';
171 cfg.cls += ' navbar-inverse';
179 initEvents :function ()
181 //Roo.log(this.el.select('.navbar-toggle',true));
182 this.el.select('.navbar-toggle',true).on('click', function() {
184 this.el.select('.navbar-collapse',true).toggleClass('in');
192 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
194 var size = this.el.getSize();
195 this.maskEl.setSize(size.width, size.height);
196 this.maskEl.enableDisplayMode("block");
205 getChildContainer : function()
207 if (this.bar === true) {
208 return this.el.select('.collapse',true).first();