Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
document.addEventListener("DOMContentLoaded", () => {
const e = document.querySelectorAll("nav a"),
t = document.querySelectorAll(".section"),
n = document.querySelector("nav");
function a(e) {
t.forEach((section) => {
section.classList.remove("active");
section.style.display = "none";
});
const s = document.getElementById(e);
s && (s.classList.add("active"), (s.style.display = "block"));
localStorage.setItem('currentSection', e);
}
function c(t) {
e.forEach((link) => {
link.classList.remove("active");
link.getAttribute("href").substring(1) === t && link.classList.add("active");
});
}
e.forEach((link) => {
link.addEventListener("click", (event) => {
event.preventDefault();
const sectionId = link.getAttribute("href").substring(1);
a(sectionId);
c(sectionId);
history.pushState(null, "", `#${sectionId}`);
document.getElementById('check').checked = false;
});
});
let l = window.location.hash.substring(1);
l || ((l = "home"), history.replaceState(null, "", `#${l}`));
a(l);
c(l);
window.addEventListener("popstate", () => {
const sectionId = window.location.hash.substring(1);
sectionId ? (a(sectionId), c(sectionId)) : (a("home"), c("home"));
});
window.addEventListener("load", () => {
const loadingScreen = document.getElementById('loading-screen');
loadingScreen.classList.add('hidden');
setTimeout(() => {
loadingScreen.style.display = 'none';
}, 300);
});
});