/** * Provides functionality for tabbed interfaces. * * @since 2.2.5 * * @package ConvertKit * @author ConvertKit */ /** * Initializes tabbed interfaces * * @since 2.2.5 */ function convertKitTabsInit() { ( function ( $ ) { // Safely call this function by destroying any previously initialized instances. convertKitTabsDestroy(); // Iterate through all JS tab instances, initializing each one. $( '.convertkit-js-tabs' ).each( function () { const nav_tab_container = $( this ), nav_tab_panels_container = $( nav_tab_container ).data( 'panels-container' ), nav_tab_panel = $( nav_tab_container ).data( 'panel' ), nav_tab_active = $( nav_tab_container ).data( 'active' ), match_height = $( nav_tab_container ).data( 'match-height' ); // Call update. convertKitTabsUpdate( nav_tab_container, nav_tab_panels_container, nav_tab_panel, nav_tab_active, $( 'a.' + nav_tab_active, $( nav_tab_container ) ).attr( 'href' ) ); // If fix height is set, define the height of the content areas to match the parent of the nav tab container. if ( typeof match_height !== 'undefined' ) { $( nav_tab_panels_container ).height( $( match_height ).innerHeight() ); } // Register a listener when a tab is clicked. $( nav_tab_container ).on( 'click.convertkit_tabs', 'a', function ( e ) { e.preventDefault(); // Update the UI to show the active tab and content associated with it. convertKitTabsUpdate( nav_tab_container, nav_tab_panels_container, nav_tab_panel, nav_tab_active, $( this ).attr( 'href' ) ); } ); } ); } )( jQuery ); } /** * For the given active tab: * - Hides all other content in the group * - Shows content associated with the active tab * * @since 1.0.0 * * @param object nav_tab_container