Skip to content

Commit 1b98aff

Browse files
committed
make the height of all tabs in the pane the same
1 parent 857bd67 commit 1b98aff

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

website_and_docs/static/js/tabpane-persist.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,25 @@ function getActiveTabFromURL() {
4141
return activeTab ? activeTab.toLowerCase() : null;
4242
}
4343

44+
function adjustTabContentHeights() {
45+
const tabPanes = document.querySelectorAll('.tab-content');
46+
47+
tabPanes.forEach(pane => {
48+
let maxHeight = 0;
49+
const tabBody = pane.querySelectorAll('.tab-body');
50+
51+
tabBody.forEach(tabContent => {
52+
tabContent.style.display = 'block'; // Temporarily show the tab content
53+
maxHeight = Math.max(maxHeight, tabContent.clientHeight);
54+
tabContent.style.display = ''; // Reset the display property
55+
});
56+
57+
tabBody.forEach(tabContent => {
58+
tabContent.style.height = maxHeight + 'px';
59+
});
60+
});
61+
}
62+
4463
// Retrieve, increment, and store tab-select event count, then returns it.
4564
function tdGetTabSelectEventCountAndInc() {
4665
// @requires: tdSupportsLocalStorage();
@@ -99,6 +118,9 @@ function tdGetAndActivatePersistedTabs(tabs) {
99118
tdActivateTabsWithKey(key);
100119
});
101120

121+
// Adjust tab content heights
122+
adjustTabContentHeights();
123+
102124
return key_ageList;
103125
}
104126

0 commit comments

Comments
 (0)