From 60bc24f45f94c2344eb61a173cc75f573cf2d9bd Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 15 Oct 2023 16:23:49 -0400 Subject: [PATCH] [js]: if hamburger checkbox is already checked, prevent scrolling --- script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.js b/script.js index 2628ff8..edaa3c7 100644 --- a/script.js +++ b/script.js @@ -3,6 +3,10 @@ document.addEventListener('DOMContentLoaded', () => { const navigationLinks = navBar.querySelectorAll('li'); const hamburgerCheckbox = navBar.querySelector('.peer'); + if (hamburgerCheckbox.checked) { + document.body.classList.add('overflow-hidden'); + } + // Hamburger navigation navigationLinks.forEach(navigationLink => {