fix: mermaid script load order

This commit is contained in:
Jacky Zhao
2025-03-10 16:20:08 -07:00
parent a8001e9554
commit 9e3e711646
4 changed files with 34 additions and 29 deletions

View File

@ -28,17 +28,15 @@ function setupCallout() {
) as HTMLCollectionOf<HTMLElement>
for (const div of collapsible) {
const title = div.firstElementChild
if (!title) continue
if (title) {
title.addEventListener("click", toggleCallout)
window.addCleanup(() => title.removeEventListener("click", toggleCallout))
title.addEventListener("click", toggleCallout)
window.addCleanup(() => title.removeEventListener("click", toggleCallout))
const collapsed = div.classList.contains("is-collapsed")
const height = collapsed ? title.scrollHeight : div.scrollHeight
div.style.maxHeight = height + "px"
}
const collapsed = div.classList.contains("is-collapsed")
const height = collapsed ? title.scrollHeight : div.scrollHeight
div.style.maxHeight = height + "px"
}
}
document.addEventListener("nav", setupCallout)
window.addEventListener("resize", setupCallout)