/* ---------------- Tabby.js 1.4.0 based on ResponsiveTabs.js 1.10 by Pete Love ------------------- */ var RESPONSIVEUI = {}; (function($) { RESPONSIVEUI.responsiveTabs = function () { var $tabSets = $('.responsive-tabs'); if (!$tabSets.hasClass('responsive-tabs--enabled')) { // if we haven't already called this function and enabled tabs $tabSets.addClass('responsive-tabs--enabled'); //loop through all sets of tabs on the page var tablistcount = 1; $tabSets.each(function() { var $tabs = $(this); // add tab heading and tab panel classes $tabs.children(':header, p').addClass('responsive-tabs__heading'); $tabs.children('div').addClass('responsive-tabs__panel'); // determine if markup already identifies the active tab panel for this set of tabs // if not then set first heading and tab to be the active one var $activePanel = $tabs.find('.responsive-tabs__panel--active'); if(!$activePanel.length) { $activePanel = $tabs.find('.responsive-tabs__panel').first().addClass('responsive-tabs__panel--active'); } /* Add active class to the active header of the panel (FOR MOBILE) */ $activeHeader = $activePanel.prev(); if($activeHeader !== null) { $activeHeader.addClass("responsive-tabs__heading--active"); } $tabs.find('.responsive-tabs__panel').not('.responsive-tabs__panel--active').hide().attr('aria-hidden','true'); //hide all except active panel $activePanel.attr('aria-hidden', 'false'); /* make active tab panel hidden for mobile * $activePanel.addClass('responsive-tabs__panel--closed-accordion-only');*/ // wrap tabs in container - to be dynamically resized to help prevent page jump var $tabsWrapper = $('
', {'class': 'responsive-tabs-wrapper' }); $tabs.wrap($tabsWrapper); var highestHeight = 0; // determine height of tallest tab panel. Used later to prevent page jump when tabs are clicked $tabs.find('.responsive-tabs__panel').each(function() { var tabHeight = $(this).height(); if (tabHeight > highestHeight) { highestHeight = tabHeight; } }); //create the tab list var $tabList = $('