You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
400 B

<script lang="ts">
import { onMount } from "svelte";
export let id = "";
let linkHook: HTMLElement;
onMount(() => {
if (window.location.hash === "#" + id) {
window.scrollTo({top: linkHook.getBoundingClientRect().top});
}
});
</script>
<div class="link-hook" id={id} bind:this={linkHook}></div>
<style>
div.link-hook {
position: relative;
top: -2em;
}
</style>