1jQuery(document).ready(function($){ 2 $(".easy-tab").each(function(){ 3 var tab = $(this); 4 var tab_id = tab.attr('id'); 5 6 /* Tab layout */ 7 easy_tab_add_tab_event(tab_id); 8 /* Collapse layout */ 9 easy_tab_add_collapse_event(tab_id); 10 11 if(tab.hasClass('responsive')){ 12 // change layout from TAB to COLLAPSE 13 $(window).resize(function () { 14 easy_tab_switch_layout(tab_id); 15 }); 16 17 // switch layout for the first time 18 easy_tab_switch_layout(tab_id); 19 } 20 }) 21 22 // check if URL contains "easy-tab" hash, then activate that tab and scroll to it 23 var hash = window.location.hash; 24 hash = hash.substring(1); 25 if(hash.indexOf("easy-tab") > -1){ 26 // show active tab 27 var tab = "#tabtitle-" + hash.substring(13,hash.length); 28 if($(tab).length > 0){ 29 $(tab).trigger('click'); 30 $(document.body).animate({ 31 'scrollTop': $(tab).offset().top 32 }, 500); 33 } 34 } 35}); 36 37 38function easy_tab_switch_layout(tab_id){ 39 var $j = jQuery.noConflict(); 40 var tab = $j('#' + tab_id); 41 if($j(window).width() < 640){ 42 if($j('.tabs',tab).length > 0){ 43 // if it is currently in TAB layout, 44 // build COLLAPSE layout 45 var html = ''; 46 $j('.tabs li',tab).each(function(){ 47 if(typeof $j(this).attr("id") !== "undefined"){ 48 var tabid = $j(this).attr("id").substr(9); 49 var tabclass = $j(this).attr("class"); 50 var tabtitle = $j(this).children("a").html(); 51 var tabcontent = $j("#tab-"+tabid).html(); 52 var customclass = tabclass.replace("active",""); // remove 'active' class (if this is an active tab) to get custom-variation class 53 var columnclass = $j("#tab-"+tabid).attr("class").replace("tab-panel","").replace("active","").replace(customclass,""); 54 55 html += '<div class="etw_collapse ' + customclass + '">'; 56 html += '<div id="tabtitle-' + tabid + '" class="' + ($j(this).hasClass('active') ? 'active ' : '') + 'heading">' + tabtitle + '</div>'; 57 html += '<div class="tab-panel ' + columnclass + '" id="tab-' + tabid + '">'; 58 html += tabcontent; 59 html += '</div></div>'; 60 } 61 }); 62 tab.html(html); 63 easy_tab_add_collapse_event(tab_id); 64 } 65 } else { 66 if($j('.etw_collapse',tab).length > 0){ 67 // if it is currently in COLLAPSE layout, 68 // build TAB layout 69 var html_tab = '<ul class="tabs">'; 70 var html_panel = '<div class="panels">'; 71 $j('.etw_collapse',tab).each(function(){ 72 var tabclass = ''; 73 var customclass = $j(this).attr("class").replace("etw_collapse",""); 74 var tabid = $j('.tab-panel',$j(this)).attr("id").substr(4); 75 var tabtitle = $j(this).children(".heading").html(); 76 var tabcontent = $j("#tab-" + tabid).html(); 77 var columnclass = $j(this).children(".tab-panel").attr("class").replace("tab-panel",""); 78 var isActive = $j(this).children(".heading").hasClass("active"); 79 html_tab += '<li id="tabtitle-' + tabid + '" class="' + (isActive ? 'active ' : ' ') + customclass + '"><a href="#tab-' + tabid + '">' + tabtitle + '</a><span class="triangle-' + (tab.hasClass('tabpos-bottom') ? 'top' : 'bottom') + '"><!-- --></span></li>'; 80 html_panel += '<div class="tab-panel ' + (isActive ? 'active ' : ' ') + customclass + ' ' + columnclass + '" id="tab-' + tabid + '">'; 81 html_panel += tabcontent; 82 html_panel += '</div>'; 83 }); 84 html_tab += '<li class="clearer"><!-- --></li></ul>'; 85 html_panel += '</div>'; 86 if(tab.hasClass('tabpos-bottom')){ 87 tab.html(html_panel + html_tab); 88 } else { 89 tab.html(html_tab + html_panel); 90 } 91 easy_tab_add_tab_event(tab_id); 92 } 93 } 94} 95 96function easy_tab_add_tab_event(tab_id){ 97 var $j = jQuery.noConflict(); 98 var tab = $j('#' + tab_id); 99 $j(".tabs li",tab).click(function() { 100 // First remove class "active" from currently active tab 101 $j(".tabs li",tab).removeClass('active'); 102 103 // Now add class "active" to the selected/clicked tab 104 $j(this).addClass("active"); 105 106 // Hide all tab content 107 $j(".tab-panel",tab).removeClass("active"); 108 109 // Here we get the href value of the selected tab 110 var selected_tab = $j(this).find("a").attr("href"); 111 112 // Show the selected tab content 113 $j(selected_tab).addClass("active"); 114 115 // Add Hash to URL 116 // window.location.hash = "easy-tab-" + selected_tab.replace("#",""); 117 // At the end, we add return false so that the click on the link is not executed 118 return false; 119 }); 120} 121function easy_tab_add_collapse_event(tab_id){ 122 var $j = jQuery.noConflict(); 123 var tab = $j('#' + tab_id); 124 $j(".heading",tab).click(function(){ 125 //$(".collapse-panel",tab).hide(); 126 $j(this).next().toggle(); 127 if($j(this).hasClass("heading-open")){ 128 $j(this).removeClass("heading-open") 129 } else { 130 $j(this).addClass("heading-open") 131 } 132 133 // Add Hash to URL 134 // window.location.hash = "easy-tab-" + $j(this).next().attr("id"); 135 // At the end, we add return false so that the click on the link is not executed 136 return false; 137 }); 138}
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.