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, {
48 getAutoCreate : function(){
53 if (this.sidebar === true) {
61 if (this.bar === true) {
75 'data-toggle': 'collapse',
80 html: 'Toggle navigation'
100 cls: 'collapse navbar-collapse'
105 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
107 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
108 cfg.cls += ' navbar-' + this.position;
109 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
112 if (this.brand !== '') {
115 href: this.brand_href ? this.brand_href : '#',
124 cfg.cls += ' main-nav';
130 } else if (this.bar === false) {
133 Roo.log('Property \'bar\' in of Navbar must be either true or false')
143 if (['tabs','pills'].indexOf(this.type)!==-1) {
144 cfg.cn[0].cls += ' nav-' + this.type
146 if (this.type!=='nav') {
147 Roo.log('nav type must be nav/tabs/pills')
149 cfg.cn[0].cls += ' navbar-nav'
152 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
153 cfg.cn[0].cls += ' nav-' + this.arrangement;
156 if (this.align === 'right') {
157 cfg.cn[0].cls += ' navbar-right';
160 cfg.cls += ' navbar-inverse';
168 initEvents :function ()
170 //Roo.log(this.el.select('.navbar-toggle',true));
171 this.el.select('.navbar-toggle',true).on('click', function() {
173 this.el.select('.navbar-collapse',true).toggleClass('in');
179 getChildContainer : function()
181 if (this.bar === true) {
182 return this.el.select('.collapse',true).first();