auto-open the saved open section

This commit is contained in:
Zvonimir Rudinski
2024-07-07 05:01:33 +02:00
parent d88e152ba6
commit da8202208d
2 changed files with 18 additions and 0 deletions

View File

@@ -71,11 +71,13 @@ const { title, hasBorder } = Astro.props;
extend(section: Element, container: HTMLElement) {
container.style.maxHeight = "1000vh";
section.classList.add("open");
sessionStorage.setItem("openSection", this.id);
}
collapse(section: Element, container: HTMLElement) {
container.style.maxHeight = "0";
section.classList.remove("open");
sessionStorage.removeItem("openSection");
}
}