From 895091bc0d2d361f93bb5312552767c40c0e319b Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Tue, 15 Mar 2022 12:34:13 -0700 Subject: [PATCH] site: support nested tabs --- site/static/js/tabs.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/site/static/js/tabs.js b/site/static/js/tabs.js index b7e4bd76b8..ec09a010b4 100644 --- a/site/static/js/tabs.js +++ b/site/static/js/tabs.js @@ -1,8 +1,8 @@ /* Tabs JS implementation. Borrowed from Skaffold */ function initTabs() { try{ - $('.tab-content').find('.tab-pane').each(function(idx, item) { - var navTabs = $(this).closest('.code-tabs').find('.nav-tabs'), + $('.tab-content').children('.tab-pane').each(function(idx, item) { + var navTabs = $(this).closest('.code-tabs').children('.nav-tabs'), title = escape($(this).attr('title')).replace(/%20/g, ' '), os = escape($(this).attr('os') || ''); navTabs.append(''); @@ -23,8 +23,9 @@ function initTabs() { var tab = $(this).parent(), tabIndex = tab.index(), tabPanel = $(this).closest('.code-tabs'), - tabPane = tabPanel.find('.tab-pane').eq(tabIndex); - tabPanel.find('.active').removeClass('active'); + tabPane = tabPanel.find('.tab-content:first').children('.tab-pane').eq(tabIndex); + tab.siblings().removeClass('active'); + tabPane.siblings().removeClass('active'); tab.addClass('active'); tabPane.addClass('active'); });