

//NAVBAR FIXED

window.onscroll = function() {
    const header = this.document.querySelector('header');
    const fixedNav = header.offsetTop;

    if(window.pageYOffset > fixedNav) {
        header.classList.add('navbar-fixed');
    } else {
        header.classList.remove('navbar-fixed');
    }
}

//hamburger

const hamburger = document.querySelector('#hamburger');
const navMenu = document.querySelector('#nav-menu');

hamburger.addEventListener('click', function() {
    hamburger.classList.toggle('hamburger-active');
    navMenu.classList.toggle('hidden');

    // tunggu 300ms (0.3 detik) lalu balik lagia
  setTimeout(() => {
    hamburger.classList.remove('hamburger-active');
  }, 300);


});