Skip to content

Commit 3b9d375

Browse files
committed
fix: hashes on notes
1 parent 2bc903b commit 3b9d375

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/pages/notes.astro

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,17 @@ export const prerender = false;
1111
<NotesIsland server:load />
1212
</main>
1313
</Layout>
14+
15+
<script>
16+
const checkAndScroll = () => {
17+
if (window.location.hash) {
18+
const el = document.querySelector(window.location.hash);
19+
if (el) {
20+
el.scrollIntoView({ behavior: "instant" });
21+
} else {
22+
requestAnimationFrame(checkAndScroll);
23+
}
24+
}
25+
};
26+
checkAndScroll();
27+
</script>

0 commit comments

Comments
 (0)