github.com/GoogleContainerTools/skaffold/v2@v2.13.2/docs-v2/static/javascripts/tabs.js (about) 1 function initTabs() { 2 $('.tab-content').children('.tab-pane').each(function(idx, item) { 3 var navTabs = $(this).closest('.code-tabs').children('.nav-tabs'), 4 title = $(this).attr('title'); 5 navTabs.append('<li class="nav-tab"><a href="#" class="nav-tab">'+title+'</a></li'); 6 }); 7 8 $('.code-tabs ul.nav-tabs').each(function() { 9 $(this).find("li:first").addClass('active'); 10 }) 11 12 $('.code-tabs .tab-content').each(function() { 13 $(this).find("div:first").addClass('active'); 14 }); 15 16 $('.nav-tabs a').click(function(e){ 17 e.preventDefault(); 18 var tab = $(this).parent(), 19 tabIndex = tab.index(), 20 tabPanel = $(this).closest('.code-tabs'), 21 tabPane = tabPanel.find('.tab-content:first').children('.tab-pane').eq(tabIndex); 22 tab.siblings().removeClass('active'); 23 tabPane.siblings().removeClass('active'); 24 tab.addClass('active'); 25 tabPane.addClass('active'); 26 }); 27 }