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
26 * @param {Object} config The config object
30 Roo.bootstrap.Navbar = function(config){
31 Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
34 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
49 getAutoCreate : function(){
54 if (this.sidebar === true) {
62 if (this.bar === true) {
76 'data-toggle': 'collapse',
81 html: 'Toggle navigation'
101 cls: 'collapse navbar-collapse'
106 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
108 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
109 cfg.cls += ' navbar-' + this.position;
110 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
113 if (this.brand !== '') {
116 href: this.brand_href ? this.brand_href : '#',
125 cfg.cls += ' main-nav';
131 } else if (this.bar === false) {
134 Roo.log('Property \'bar\' in of Navbar must be either true or false')
144 if (['tabs','pills'].indexOf(this.type)!==-1) {
145 cfg.cn[0].cls += ' nav-' + this.type
147 if (this.type!=='nav') {
148 Roo.log('nav type must be nav/tabs/pills')
150 cfg.cn[0].cls += ' navbar-nav'
153 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
154 cfg.cn[0].cls += ' nav-' + this.arrangement;
157 if (this.align === 'right') {
158 cfg.cn[0].cls += ' navbar-right';
161 cfg.cls += ' navbar-inverse';
169 initEvents :function ()
171 //Roo.log(this.el.select('.navbar-toggle',true));
172 this.el.select('.navbar-toggle',true).on('click', function() {
174 this.el.select('.navbar-collapse',true).toggleClass('in');
180 getChildContainer : function()
182 if (this.bar === true) {
183 return this.el.select('.collapse',true).first();