From 6fe806b7038d66eeacab263e72bc9b619019aa87 Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 15 Oct 2023 13:26:25 -0400 Subject: [PATCH 1/5] Move JavaScript to its own file --- index.html | 11 +---------- script.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 script.js diff --git a/index.html b/index.html index 1ded21d..8049ca2 100644 --- a/index.html +++ b/index.html @@ -212,16 +212,7 @@

Why sponsor?

© 2023 DandyHacks - + diff --git a/script.js b/script.js new file mode 100644 index 0000000..be38aad --- /dev/null +++ b/script.js @@ -0,0 +1,12 @@ +document.addEventListener('DOMContentLoaded', e => { + // Hamburger navigation + + let navigationLinks = document.querySelectorAll('nav li'); + let hamburgerCheckbox = document.querySelector('nav .peer'); + + navigationLinks.forEach(navigationLink => { + navigationLink.addEventListener('click', e => { + hamburgerCheckbox.checked = false; + }); + }); +}); From 930efb9dd7f5ce4e1b9985f04a46adc9e1cf6552 Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 15 Oct 2023 14:31:44 -0400 Subject: [PATCH 2/5] Smart navbar --- index.html | 4 +- script.js | 39 ++++++++++++++--- styles.css | 123 +++++++++++++++++------------------------------------ 3 files changed, 76 insertions(+), 90 deletions(-) diff --git a/index.html b/index.html index 8049ca2..7386757 100644 --- a/index.html +++ b/index.html @@ -9,12 +9,12 @@ -