diff --git a/js/layouts/tab-container/scrollable-tabs.js b/js/layouts/tab-container/scrollable-tabs.js index ab80b0505..69c53597a 100644 --- a/js/layouts/tab-container/scrollable-tabs.js +++ b/js/layouts/tab-container/scrollable-tabs.js @@ -17,8 +17,8 @@ $.widget( "itop.scrollabletabs", $.ui.tabs, { me._newScene(b.tab, b.panel).addTo(me.controller); }; this.element.on('scrollabletabsload', afterloadajax); - - this._super(); + + this._super(this.options); // Load remote tabs as soon as possible $(this.js_selectors.tab_toggler).each(function() { @@ -37,7 +37,10 @@ $.widget( "itop.scrollabletabs", $.ui.tabs, { me._newScene($(that).parent('li'), $($(that).attr('href'))).addTo(me.controller); } }); - + + // Set active tab, tab-container gives us a tab based on url hash or 0 + this.setTab(this._findActive(this.options.active)); + this.controller.scrollTo('#' + this.tabs.eq(this.options.active).attr('data-tab-id')); }, // Create a new scene to be added to the controller _newScene: function(tab, panel) diff --git a/js/layouts/tab-container/tab-container.js b/js/layouts/tab-container/tab-container.js index 73d6c3092..b11be02a9 100644 --- a/js/layouts/tab-container/tab-container.js +++ b/js/layouts/tab-container/tab-container.js @@ -63,7 +63,8 @@ $(function() let oTabsParams = { classes: { 'ui-tabs-panel': 'ibo-tab-container--tab-container', // For ajax tabs, so their containers have the right CSS classes - } + }, + active: $.bbq.getState( this.element.attr('id'), true ) || 0 }; if ($.bbq) { // Enable tabs on all tab widgets. The `event` property must be overridden so