Define vh CSS variable from viewport height
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
export let data: PageData
|
||||
|
||||
let innerHeight: number
|
||||
|
||||
// Fonts to preload
|
||||
const fonts = [
|
||||
@@ -58,8 +59,12 @@
|
||||
// Avoid FOUC
|
||||
document.body.style.opacity = '1'
|
||||
})
|
||||
|
||||
$: innerHeight && document.body.style.setProperty('--vh', `${innerHeight}px`)
|
||||
</script>
|
||||
|
||||
<svelte:window bind:innerHeight />
|
||||
|
||||
<svelte:head>
|
||||
{#each fonts as font}
|
||||
<link rel="preload" href="/fonts/{font}.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
||||
|
||||
Reference in New Issue
Block a user