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);
35 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component, {
50 getAutoCreate : function(){
55 if (this.sidebar === true) {
63 if (this.bar === true) {
77 'data-toggle': 'collapse',
82 html: 'Toggle navigation'
102 cls: 'collapse navbar-collapse'
107 cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
109 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
110 cfg.cls += ' navbar-' + this.position;
111 cfg.tag = this.position == 'fixed-bottom' ? 'footer' : 'header';
114 if (this.brand !== '') {
117 href: this.brand_href ? this.brand_href : '#',
126 cfg.cls += ' main-nav';
132 } else if (this.bar === false) {
135 Roo.log('Property \'bar\' in of Navbar must be either true or false')
145 if (['tabs','pills'].indexOf(this.type)!==-1) {
146 cfg.cn[0].cls += ' nav-' + this.type
148 if (this.type!=='nav') {
149 Roo.log('nav type must be nav/tabs/pills')
151 cfg.cn[0].cls += ' navbar-nav'
154 if (['stacked','justified'].indexOf(this.arrangement)!==-1) {
155 cfg.cn[0].cls += ' nav-' + this.arrangement;
158 if (this.align === 'right') {
159 cfg.cn[0].cls += ' navbar-right';
162 cfg.cls += ' navbar-inverse';
170 initEvents :function ()
172 //Roo.log(this.el.select('.navbar-toggle',true));
173 this.el.select('.navbar-toggle',true).on('click', function() {
175 this.el.select('.navbar-collapse',true).toggleClass('in');
183 this.maskEl = Roo.DomHelper.append(this.el, mark, true);
185 var size = this.el.getSize();
186 this.maskEl.setSize(size.width, size.height);
187 this.maskEl.enableDisplayMode("block");
196 getChildContainer : function()
198 if (this.bar === true) {
199 return this.el.select('.collapse',true).first();
217 Roo.apply(Roo.bootstrap.Navbar, {
221 register : function(navbar, item)
223 items[navbar.navId + item.tabId] = item;
224 item.navId = navbar.navId;