Skip to content

Instantly share code, notes, and snippets.

@KABBOUCHI
Forked from Bradcomp/toggle-menu.js
Created May 27, 2017 21:06
Show Gist options
  • Save KABBOUCHI/45407f37af6fcab2066b00c68003e808 to your computer and use it in GitHub Desktop.
Save KABBOUCHI/45407f37af6fcab2066b00c68003e808 to your computer and use it in GitHub Desktop.
Toggles the .is-active class for a hamburger menu
(function() {
var burger = document.querySelector('.nav-toggle');
var menu = document.querySelector('.nav-menu');
burger.addEventListener('click', function() {
burger.classList.toggle('is-active');
menu.classList.toggle('is-active');
});
})();
@ahmkam4810
Copy link

const navSlide = () => {
const burger = document.querySelector('.burger');
const nav = document.querySelector('.nav-link');
const navlink = document.querySelectorAll('.nav-link li');

burger.addEventListener("click", () => {
    nav.classList.toggle('nav-active');
});
    navlink.forEach((link, index) => {
        link.style.animation = 'navlinkfade 0.5s ease forwards ${index/7}s';
        console.log(index/5); 
    });

}
navSlide();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment