diff --git a/about.html b/about.html index e61275d..53e6006 100644 --- a/about.html +++ b/about.html @@ -265,50 +265,6 @@ + - diff --git a/index.html b/index.html index 9a68272..9ddbd6f 100644 --- a/index.html +++ b/index.html @@ -339,7 +339,7 @@
@@ -351,73 +351,6 @@ + - - - - - - - diff --git a/scripts/about.js b/scripts/about.js new file mode 100644 index 0000000..9f78fd6 --- /dev/null +++ b/scripts/about.js @@ -0,0 +1,43 @@ +const showPopupButtons = document.querySelectorAll(".showPopupButton"); +const closePopupButton = document.querySelector(".closePopupButton"); +const popup = document.querySelector(".popup"); +const overlay = document.getElementById("overlay"); +// showPopupButton.addEventListener("click", function() { +// popup.style.display = "block"; +// overlay.style.display = "block"; +// }); +showPopupButtons.forEach((button) => { + button.addEventListener("click", function () { + // Determine which button was clicked and show the popup accordingly + const trigger = button.getAttribute("data-popup-trigger"); + if ( + trigger === "donate" || + trigger === "cover-page" || + trigger === "navbar" + ) { + popup.style.display = "block"; + overlay.style.display = "block"; + } + }); +}); + +closePopupButton.addEventListener("click", function () { + popup.style.display = "none"; + overlay.style.display = "none"; +}); + +const close = document.querySelectorAll(".navclose"); +document.getElementById("openMenu").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "flex"; +}); + +document.getElementById("closeMenu").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "none"; +}); +document.querySelectorAll(".close").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "none"; +}); + +function handleClose() { + document.getElementById("menuContainer").style.display = "none"; +} \ No newline at end of file diff --git a/scripts/index.js b/scripts/index.js new file mode 100644 index 0000000..79996fe --- /dev/null +++ b/scripts/index.js @@ -0,0 +1,62 @@ + const showPopupButtons = document.querySelectorAll(".showPopupButton"); + const closePopupButton = document.querySelector(".closePopupButton"); + const popup = document.querySelector(".popup"); + const overlay = document.getElementById("overlay"); + // showPopupButton.addEventListener("click", function() { + // popup.style.display = "block"; + // overlay.style.display = "block"; + // }); + showPopupButtons.forEach((button) => { + button.addEventListener("click", function () { + // Determine which button was clicked and show the popup accordingly + const trigger = button.getAttribute("data-popup-trigger"); + if ( + trigger === "donate" || + trigger === "cover-page" || + trigger === "navbar" + ) { + popup.style.display = "block"; + overlay.style.display = "block"; + } + }); + }); + + closePopupButton.addEventListener("click", function () { + popup.style.display = "none"; + overlay.style.display = "none"; + }); + + const close = document.querySelectorAll(".navclose"); + document.getElementById("openMenu").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "flex"; + }); + + document.getElementById("closeMenu").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "none"; + }); + document.querySelectorAll(".close").addEventListener("click", function () { + document.getElementById("menuContainer").style.display = "none"; + }); + + function handleClose() { + document.getElementById("menuContainer").style.display = "none"; + } + + +// functionality of the scroll effect for the navbar + const nav = document.querySelector('nav'); + const whereWePlantSection = document.querySelector('.locations'); + + // Function to add/remove dark background + function handleScroll() { + const sectionTop = whereWePlantSection.getBoundingClientRect().top; + const threshold = window.innerHeight * 0.1; + + if (sectionTop <= threshold) { + nav.classList.add('dark'); + } else { + nav.classList.remove('dark'); + } + } + + window.addEventListener('scroll', handleScroll); \ No newline at end of file