mirror of
https://github.com/helenclx/leilukin-site.git
synced 2025-03-15 05:47:14 +00:00
28 lines
883 B
Plaintext
28 lines
883 B
Plaintext
|
<aside class="left-sidebar">
|
||
|
<details class="toc__wrapper">
|
||
|
<summary class="toc__heading">
|
||
|
Contents
|
||
|
</summary>
|
||
|
{{ content | toc | safe }}
|
||
|
</details>
|
||
|
</aside>
|
||
|
<script defer>
|
||
|
// Close article ToC accordion for small screen sizes
|
||
|
const tocWrapper = docucument.querySelector('.toc__wrapper');
|
||
|
const tocEl = docucument.querySelector('.toc');
|
||
|
if (window.innerWidth < 480) {
|
||
|
tocWrapper.removeAttribute("open");
|
||
|
} else {
|
||
|
tocWrapper.setAttribute("open", true);
|
||
|
}
|
||
|
|
||
|
// Remove the stickiness of the sidebar ToC if it is larger than screen height
|
||
|
function preventSidebarOverflow() {
|
||
|
if (document.documentElement.clientHeight < tocEl.offsetHeight + 50) {
|
||
|
tocEl.style.marginTop = "0";
|
||
|
tocEl.style.position = "static";
|
||
|
}
|
||
|
}
|
||
|
preventSidebarOverflow();
|
||
|
</script>
|