site: support nested tabs
parent
58c4142ab9
commit
895091bc0d
|
|
@ -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('<li class="nav-tab '+os+'"><a href="#" class="nav-tab">'+title+'</a></li>');
|
||||
|
|
@ -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');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue