From 3328fb955f858ac297d670052d50e4a535db5db3 Mon Sep 17 00:00:00 2001 From: prototypa Date: Fri, 12 Apr 2024 12:21:13 -0400 Subject: [PATCH] Fix some errors with ViewTransitions --- src/components/common/BasicScripts.astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/common/BasicScripts.astro b/src/components/common/BasicScripts.astro index 202a1fc..4ee6a64 100644 --- a/src/components/common/BasicScripts.astro +++ b/src/components/common/BasicScripts.astro @@ -118,10 +118,11 @@ import { UI } from 'astrowind:config'; function applyHeaderStylesOnScroll() { const header = document.querySelector('#header[data-aw-sticky-header]'); + if (!header) return; if (lastKnownScrollPosition > 60 && !header.classList.contains('scroll')) { - document.getElementById('header').classList.add('scroll'); + header.classList.add('scroll'); } else if (lastKnownScrollPosition <= 60 && header.classList.contains('scroll')) { - document.getElementById('header').classList.remove('scroll'); + header.classList.remove('scroll'); } ticking = false; }