fbpx
document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (event) { event.preventDefault(); const targetID = this.getAttribute('href').substring(1); const targetElement = document.getElementById(targetID); if (targetElement) { const offset = 200; // Height of the sticky header const elementPosition = targetElement.getBoundingClientRect().top + window.pageYOffset; window.scrollTo({ top: elementPosition - offset, behavior: 'smooth' // Smooth scroll }); } }); }); });