feat: add scroll reset on navigation

This commit is contained in:
2026-03-06 23:00:30 -06:00
parent d3b2b40ccb
commit 07c7edeb0f

View File

@@ -79,7 +79,7 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
<Header />
<!-- Main body -->
<div class="mask-container w-screen h-screen overflow-y-auto overflow-x-hidden">
<div id="reset-scroll" class="mask-container w-screen h-screen overflow-y-auto overflow-x-hidden">
<main>
<!-- Content -->
@@ -96,6 +96,17 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
</body>
</html>
<script>
const resetScroll = () => {
const scrollContainer = document.getElementById('reset-scroll');
if (scrollContainer) {
scrollContainer.scrollTop = 0;
}
};
resetScroll();
document.addEventListener('astro:after-swap', resetScroll);
</script>
<style>
/* Fade away content below header when scrolling */
.mask-container {