6 * navbar-expand-md fixed-top
10 * @class Roo.bootstrap.NavHeaderbar
11 * @extends Roo.bootstrap.NavSimplebar
12 * Bootstrap Sidebar class
14 * @cfg {String} brand what is brand
15 * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
16 * @cfg {String} brand_href href of the brand
17 * @cfg {Boolean} srButton generate the (screen reader / mobile) sr-only button default true
18 * @cfg {Boolean} autohide a top nav bar header that hides on scroll.
19 * @cfg {Boolean} desktopCenter should the header be centered on desktop using a container class
20 * @cfg {Roo.bootstrap.Row} mobilerow - a row to display on mobile only..
23 * Create a new Sidebar
24 * @param {Object} config The config object
28 Roo.bootstrap.NavHeaderbar = function(config){
29 Roo.bootstrap.NavHeaderbar.superclass.constructor.call(this, config);
33 Roo.extend(Roo.bootstrap.NavHeaderbar, Roo.bootstrap.NavSimplebar, {
40 desktopCenter : false,
43 getAutoCreate : function(){
46 tag: this.nav || 'nav',
47 cls: 'navbar navbar-expand-md',
53 if (this.desktopCenter) {
54 cn.push({cls : 'container', cn : []});
62 cls: 'navbar-toggle navbar-toggler',
63 'data-toggle': 'collapse',
68 html: 'Toggle navigation'
72 cls: 'icon-bar navbar-toggler-icon'
85 cn.push( Roo.bootstrap.version == 4 ? btn : {
96 cls: 'collapse navbar-collapse',
100 cfg.cls += this.inverse ? ' navbar-inverse navbar-dark bg-dark' : ' navbar-default';
102 if (['light','white'].indexOf(this.weight) > -1) {
103 cfg.cls += ['light','white'].indexOf(this.weight) > -1 ? ' navbar-light' : ' navbar-dark';
105 cfg.cls += ' bg-' + this.weight;
108 if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
109 cfg.cls += ' navbar-' + this.position + ' ' + this.position ;
111 // tag can override this..
113 cfg.tag = this.tag || (this.position == 'fixed-bottom' ? 'footer' : 'header');
116 if (this.brand !== '') {
117 var cp = Roo.bootstrap.version == 4 ? cn : cn[0].cn;
118 cp.unshift({ // changed from push ?? BS4 needs it at the start? - does this break or exsiting?
120 href: this.brand_href ? this.brand_href : '#',
129 cfg.cls += ' main-nav';
137 getHeaderChildContainer : function()
139 if (this.srButton && this.el.select('.navbar-header').getCount()) {
140 return this.el.select('.navbar-header',true).first();
143 return this.getChildContainer();
147 initEvents : function()
149 Roo.bootstrap.NavHeaderbar.superclass.initEvents.call(this);
156 Roo.get(document).on('scroll',function(e) {
157 var ns = Roo.get(document).getScroll().top;
162 ft.removeClass('slideDown');
163 ft.addClass('slideUp');
166 ft.removeClass('slideUp');
167 ft.addClass('slideDown');