Emile Bangma
2025-03-12 ca08ec1ae7c0003a186fb5a38b56208d4baf30bd
quartz/components/scripts/callout.inline.ts
@@ -28,17 +28,15 @@
  ) 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)