diff options
-rw-r--r-- | docs/src/components/SiteSidebar.astro | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/src/components/SiteSidebar.astro b/docs/src/components/SiteSidebar.astro index 7edfda514..03bced101 100644 --- a/docs/src/components/SiteSidebar.astro +++ b/docs/src/components/SiteSidebar.astro @@ -21,6 +21,15 @@ const {currentPage} = Astro.props; </ul> </nav> +<script> + window.addEventListener('DOMContentLoaded', (event) => { + var target = document.querySelector('.nav-link.is-active'); + if (target && (target.offsetTop > (window.innerHeight - 100))) { + document.querySelector('.nav-groups').scrollTop = target.offsetTop; + } + }); +</script> + <style> nav { width: 100%; |