Skip to content

Commit ae3862f

Browse files
committed
make the height of all tabs in the pane the same
1 parent 766c611 commit ae3862f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

website_and_docs/static/js/tabpane-persist.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,23 @@ function getActiveTabFromURL() {
4040
return urlParams.get('tab').toLowerCase();
4141
}
4242

43+
function adjustTabContentHeights() {
44+
const tabPanes = document.querySelectorAll('.tab-content');
45+
46+
tabPanes.forEach(pane => {
47+
let maxHeight = 0;
48+
const tabBody = pane.querySelectorAll('.tab-body');
49+
50+
tabBody.forEach(tabContent => {
51+
tabContent.style.display = 'block'; // Temporarily show the tab content
52+
maxHeight = Math.max(maxHeight, tabContent.clientHeight);
53+
tabContent.style.display = ''; // Reset the display property
54+
});
55+
56+
pane.style.height = maxHeight + 'px';
57+
});
58+
}
59+
4360
// Retrieve, increment, and store tab-select event count, then returns it.
4461
function tdGetTabSelectEventCountAndInc() {
4562
// @requires: tdSupportsLocalStorage();
@@ -98,6 +115,9 @@ function tdGetAndActivatePersistedTabs(tabs) {
98115
tdActivateTabsWithKey(key);
99116
});
100117

118+
// Adjust tab content heights
119+
adjustTabContentHeights();
120+
101121
return key_ageList;
102122
}
103123

0 commit comments

Comments
 (0)