/** * Custom scripts needed for the colorpicker, image button selectors, * and navigation tabs. */ jQuery(document).ready(function($) { // Loads tabbed sections if they exist if ( $('.nav-tab-wrapper').length > 0 ) { ak_tabs(); } function ak_tabs() { // Hides all the .group sections to start $('.group').hide(); // Find if a selected tab is saved in localStorage var active_tab = ''; if ( typeof(localStorage) != 'undefined' ) { active_tab = localStorage.getItem("active_tab"); } // If active tab is saved and exists, load it's .group if (active_tab != '' && $(active_tab).length ) { $(active_tab).fadeIn(); $(active_tab + '-tab').addClass('nav-tab-active'); } else { $('.group:first').fadeIn(); $('.nav-tab-wrapper a:first').addClass('nav-tab-active'); } // Bind tabs clicks $('.nav-tab-wrapper a').click(function(evt) { evt.preventDefault(); // Remove active class from all tabs $('.nav-tab-wrapper a').removeClass('nav-tab-active'); $(this).addClass('nav-tab-active').blur(); var group = $(this).attr('href'); if (typeof(localStorage) != 'undefined' ) { localStorage.setItem("active_tab", $(this).attr('href') ); } $('.group').hide(); $(group).fadeIn(); }); } });