Skip to content

Commit e07d21a

Browse files
committed
Fix delay when collapsing collapsibles.
1 parent 1f41d18 commit e07d21a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

pydis_site/static/css/collapsibles.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
}
77

88
.collapsible-content {
9-
max-height: 40em;
109
transition: max-height 0.3s ease-out;
1110
}
1211

1312
.collapsible-content.collapsed {
1413
overflow: hidden;
15-
max-height: 0;
14+
max-height: 0 !important;
1615
}

pydis_site/static/js/collapsibles.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
document.addEventListener("DOMContentLoaded", () => {
2+
// Set maxHeight to scroll height on all matching collapsibles
3+
const contentContainers = document.getElementsByClassName("collapsible-content");
4+
for (const container of contentContainers) {
5+
container.style.maxHeight = container.scrollHeight + "px";
6+
}
7+
28
const headers = document.getElementsByClassName("collapsible");
39
for (const header of headers) {
410
header.addEventListener("click", () => {

0 commit comments

Comments
 (0)