Skip to content

Commit 43b3cab

Browse files
committed
make the height of all tabs in the pane the same
1 parent 2823318 commit 43b3cab

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

website_and_docs/static/js/tabpane-persist.js

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

44+
function adjustTabContentHeights() {
45+
const contentTabs = document.querySelectorAll('.tab-content');
46+
47+
// Loop through each tabpane
48+
contentTabs.forEach(contentTab => {
49+
let maxHeight = 0;
50+
const tabPanes = contentTab.querySelectorAll('.tab-pane');
51+
52+
// Loop through each tab in the tabpanes list to find max
53+
tabPanes.forEach(tab => {
54+
tab.style.display = 'block';
55+
maxHeight = Math.max(maxHeight, tab.clientHeight);
56+
tab.style.display = '';
57+
});
58+
59+
// Loop through each tab in the tabpanes list to set height
60+
tabPanes.forEach(tab => {
61+
tab.style.height = maxHeight + 'px';
62+
});
63+
});
64+
}
65+
4466
// Retrieve, increment, and store tab-select event count, then returns it.
4567
function tdGetTabSelectEventCountAndInc() {
4668
// @requires: tdSupportsLocalStorage();
@@ -99,6 +121,9 @@ function tdGetAndActivatePersistedTabs(tabs) {
99121
tdActivateTabsWithKey(key);
100122
});
101123

124+
// Adjust tab content heights
125+
adjustTabContentHeights();
126+
102127
return key_ageList;
103128
}
104129

0 commit comments

Comments
 (0)