Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,21 @@ function codeTabs() {

tabBar.append(
'<li class="nav-item"><button class="' +
active + 'nav-link tab_' + lang + '" data-bs-target="#' + id +
'" data-bs-toggle="tab">' + buttonLabel + '</button></li>'
active + 'nav-link tab_' + lang + '" data-bs-target="#' +
id + '" data-tab-lang="tab_' + lang + '" data-bs-toggle="tab">' +
buttonLabel + '</button></li>'
);
});
counter++;
});
$("ul.nav-tabs button").click(function (e) {
// Toggling a tab should switch all tabs corresponding to the same language
// while retaining the scroll position
e.preventDefault();
var scrollOffset = $(this).offset().top - $(document).scrollTop();
$("." + $(this).attr('data-tab-lang')).tab('show');
$(document).scrollTop($(this).offset().top - scrollOffset);
});
}


Expand Down