document.addEventListener('DOMContentLoaded', () => { setupNavigationHighlight(); setupNavigationClicks(); setupCopyright(); }); function setupNavigationHighlight() { const sections = document.querySelectorAll('.scroll_section'); const navOptions = document.querySelectorAll('.nav_option'); const observer = new IntersectionObserver((entries) => { entries.forEach(entry => { if (entry.isIntersecting) { const sectionId = entry.target.id; window.history.replaceState(null, null, `#${sectionId}`); navOptions.forEach(link => { link.classList.toggle('active', link.getAttribute('href') === `#${sectionId}`); }); } }); }, { threshold: 0.5 }); sections.forEach(section => observer.observe(section)); } function setupNavigationClicks() { document.querySelectorAll('.nav_option').forEach(link => { link.addEventListener('click', (event) => { event.preventDefault(); const targetId = link.getAttribute('href'); const targetSection = document.querySelector(targetId); if (targetSection) { targetSection.scrollIntoView({ behavior: 'smooth' }); } }); }); } function setupCopyright() { document.getElementById('copyright').textContent = `© ${new Date().getFullYear()} - douwco.be`; }