From 7781bfdb149a389f225d3da9972755d9421ea7db Mon Sep 17 00:00:00 2001 From: Ushie Date: Sat, 14 Jun 2025 05:04:00 +0300 Subject: [PATCH] feat: Improve visibility check logic and styling --- src/routes/+page.svelte | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 5c02968..010d074 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -7,20 +7,13 @@ let bottomVisibility = true; + const checkVisibility = () => { + const wave = document.querySelector('.wave'); + bottomVisibility = !(wave && wave.getBoundingClientRect().bottom < window.innerHeight - 1); + }; + onMount(() => { - const checkVisibility = () => { - const wave = document.querySelector('.wave'); - bottomVisibility = !(wave && wave.getBoundingClientRect().bottom < window.innerHeight - 1); - }; - - window.addEventListener('scroll', checkVisibility, { passive: true }); - window.addEventListener('resize', checkVisibility); - checkVisibility(); // Initial check - return () => { - window.removeEventListener('scroll', checkVisibility); - window.removeEventListener('resize', checkVisibility); - }; }); @@ -135,7 +128,9 @@ ]} /> -
+ + +
@@ -161,10 +156,17 @@ flex-direction: column; align-items: center; + @media (max-height: 600px), (max-width: 450px) and (max-height: 780px) { + min-height: initial; + } + @media (max-width: 335px) { padding: 2rem 0 !important; } + &.visibility { + min-height: initial; + } } .hero-img-container {