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;
117 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
120 if (this.brand !== '') {
123 href: this.brand_href ? this.brand_href : '#',
132 cfg.cls += ' main-nav';
138 } else if (this.bar === false) {
141 Roo.log('Property \'bar\' in of Navbar must be either true or false')
150 this.type = this.type || 'nav';
151 if (['tabs','pills'].indexOf(this.type)!==-1) {
152 cfg.cn[0].cls += ' nav-' + this.type
154 if (this.type!=='nav') {
155 Roo.log('nav type must be nav/tabs/pills')
157 cfg.cn[0].cls += ' navbar-nav'
160 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
161 cfg.cn[0].cls += ' nav-' + this.arrangement;
164 if (this.align === 'right') {
165 cfg.cn[0].cls += ' navbar-right';
168 cfg.cls += ' navbar-inverse';
176 initEvents :function ()
178 //Roo.log(this.el.select('.navbar-toggle',true));
179 this.el.select('.navbar-toggle',true).on('click', function() {
181 this.el.select('.navbar-collapse',true).toggleClass('in');
189 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
191 var size = this.el.getSize();
192 this.maskEl.setSize(size.width, size.height);
193 this.maskEl.enableDisplayMode("block");
202 getChildContainer : function()
204 if (this.bar === true) {
205 return this.el.select('.collapse',true).first();