1/* Clean Tabs: responsive tabs to accordion */ 2 3/* Version 1.1: Added the possibility to nest tabs. */ 4/* Works with the following themes: empty, clear, dark, linear, metro1-2-3-4, stock1-2-3, bordy1-2, fullscreen */ 5 6(function($) { 7 8 $.fn.cleanTabs = function(options) { 9 10 var base = $(this); 11 12 // Single tab content 13 base.$tab_content = base.find(" > .tab-content-block > .tab_content"); 14 15 // Horizontal navigation 16 base.$nav = base.find(" > ul.tab-nav > li"); 17 18 // Vertical navigation 19 base.$v_nav = base.find(" > .tab-content-block > .v_nav"); 20 21 // Options 22 base.options = $.extend({},$.fn.cleanTabs.defaultOptions, options); 23 24 25 26 27 // Hide all except for first content 28 base.$tab_content.not(":first").hide(); 29 30 31 32 33 // Horizontal click 34 base.$nav.on("click", function() { 35 36 // Hide content 37 base.$tab_content.hide(); 38 39 // Set a new variable 40 var h_active = $(this).attr("data-tab"); 41 $("#"+h_active).fadeIn(base.options.speed); 42 43 // New active class 44 base.$nav.removeClass("active"); 45 $(this).addClass("active"); 46 47 // Adjust between horizontal and vertical 48 base.$v_nav.removeClass("v_active"); 49 $(".v_nav[data-tab^='"+h_active+"']").addClass("v_active"); 50 51 }); 52 53 54 // Vertical click 55 base.$v_nav.on("click", function() { 56 57 // Hide content 58 base.$tab_content.hide(); 59 60 // Set a new variable 61 var v_active = $(this).attr("data-tab"); 62 $("#"+v_active).fadeIn(base.options.speed); 63 64 // New active class 65 base.$v_nav.removeClass("v_active"); 66 $(this).addClass("v_active"); 67 68 // Adjust between horizontal and vertical 69 base.$nav.removeClass("active"); 70 $("ul.nav li[data-tab^='"+v_active+"']").addClass("active"); 71 72 }); 73 74 75 }; 76 77 $.fn.cleanTabs.defaultOptions = { 78 "speed": 300 79 }; 80 81})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.