document.addEventListener('DOMContentLoaded', function () { const navbar = document.querySelector('.navbar-container'); const hamburger = document.getElementById('hamburger'); const menu = document.querySelector('.menu'); const threshold = 100; function updateNavbarBackground() { if (window.scrollY > threshold) { navbar.classList.add('scrolled'); } else { navbar.classList.remove('scrolled'); } } window.addEventListener('scroll', updateNavbarBackground); updateNavbarBackground(); hamburger.addEventListener('click', function() { menu.classList.toggle('show'); hamburger.classList.toggle('active'); }); document.addEventListener('click', function(event) { if (!menu.contains(event.target) && !hamburger.contains(event.target)) { menu.classList.remove('show'); hamburger.classList.remove('active'); } }); const dropdowns = document.querySelectorAll('.dropdown'); dropdowns.forEach(dropdown => { dropdown.addEventListener('click', function(e) { if (window.innerWidth <= 768) { e.preventDefault(); this.querySelector('.dropdown-content').classList.toggle('show'); } }); }); });