From 2eb87b2dbac9ed28baa487ce546a765dd8c0dfea Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Mon, 28 Sep 2020 16:25:46 +0200 Subject: [PATCH] resize on body resize --- src/routes/_layout.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index bed2997..ca1aee1 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -6,8 +6,14 @@ export let segment let wrapper - onMount(() => { + function resize() { wrapper.style.height = `${window.innerHeight}px` + } + + onMount(() => { + const listener = window.addEventListener('resize', resize) + resize() + return () => window.removeEventListener(listener) })