Define vh CSS variable from viewport height
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
export let data: PageData
|
export let data: PageData
|
||||||
|
|
||||||
|
let innerHeight: number
|
||||||
|
|
||||||
// Fonts to preload
|
// Fonts to preload
|
||||||
const fonts = [
|
const fonts = [
|
||||||
@@ -58,8 +59,12 @@
|
|||||||
// Avoid FOUC
|
// Avoid FOUC
|
||||||
document.body.style.opacity = '1'
|
document.body.style.opacity = '1'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$: innerHeight && document.body.style.setProperty('--vh', `${innerHeight}px`)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window bind:innerHeight />
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
{#each fonts as font}
|
{#each fonts as font}
|
||||||
<link rel="preload" href="/fonts/{font}.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
<link rel="preload" href="/fonts/{font}.woff2" as="font" type="font/woff2" crossorigin="anonymous">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
top: 80px;
|
top: 80px;
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: calc(100vh - 80px);
|
height: calc(var(--vh) - 80px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
top: 24px;
|
top: 24px;
|
||||||
right: 24px;
|
right: 24px;
|
||||||
width: clamp(320px, 45vw, 500px);
|
width: clamp(320px, 45vw, 500px);
|
||||||
height: calc(100vh - 48px);
|
height: calc(var(--vh) - 48px);
|
||||||
max-height: 1000px;
|
max-height: 1000px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 24px 32px 32px;
|
padding: 24px 32px 32px;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
:global(.photo-page) {
|
:global(.photo-page) {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: var(--vh);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
Reference in New Issue
Block a user