diff --git a/js/layouts/tab-container/tab-container.js b/js/layouts/tab-container/tab-container.js index 1168c70fb..81761e274 100644 --- a/js/layouts/tab-container/tab-container.js +++ b/js/layouts/tab-container/tab-container.js @@ -47,34 +47,35 @@ $(function() var me = this; this.element.addClass(this.css_classes.tab_container); - // Ugly patch for a change in the behavior of jQuery UI: - // Before jQuery UI 1.9, tabs were always considered as "local" (opposed to Ajax) - // when their href was beginning by #. Starting with 1.9, a tag in the page - // is taken into account and causes "local" tabs to be considered as Ajax - // unless their URL is equal to the URL of the page... - if ($('base').length > 0) { - this.element.find(this.js_selectors.tab_toggler).each(function () { - const sHash = location.hash; - const sCleanLocation = location.href.toString().replace(sHash, '').replace(/#$/, ''); - $(this).attr('href', sCleanLocation + $(this).attr('href')); - }); - } + // Ugly patch for a change in the behavior of jQuery UI: + // Before jQuery UI 1.9, tabs were always considered as "local" (opposed to Ajax) + // when their href was beginning by #. Starting with 1.9, a tag in the page + // is taken into account and causes "local" tabs to be considered as Ajax + // unless their URL is equal to the URL of the page... + if ($('base').length > 0) { + this.element.find(this.js_selectors.tab_toggler).each(function () { + const sHash = location.hash; + const sCleanLocation = location.href.toString().replace(sHash, '').replace(/#$/, ''); + $(this).attr('href', sCleanLocation+$(this).attr('href')); + }); + } - if ($.bbq) { - // This selector will be reused when selecting actual tab widget A elements. - const sTabAnchorSelector = 'ul.ui-tabs-nav a'; + let oTabsParams = { + classes: { + 'ui-tabs-panel': 'ibo-tab-container--tab-container', // For ajax tabs, so their containers have the right CSS classes + } + }; + if ($.bbq) { + // Enable tabs on all tab widgets. The `event` property must be overridden so + // that the tabs aren't changed on click, and any custom event name can be + // specified. Note that if you define a callback for the 'select' event, it + // will be executed for the selected tab whenever the hash changes. + oTabsParams['event'] = 'change'; + } + this._addTabsWidget(oTabsParams); - // Enable tabs on all tab widgets. The `event` property must be overridden so - // that the tabs aren't changed on click, and any custom event name can be - // specified. Note that if you define a callback for the 'select' event, it - // will be executed for the selected tab whenever the hash changes. - this._addTabsWidget({event: 'change'}); - } else { - this._addTabsWidget(); - } - - this._bindEvents(); + this._bindEvents(); }, _addTabsWidget: function(aParams) {