Created
August 29, 2020 17:25
-
-
Save wpflames/6a40d52411407db104b00855c0d32d8c to your computer and use it in GitHub Desktop.
Hamburger Menu Toggle Animation 2 - JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const menuBtn = document.querySelector('.menu-btn'); | |
| const nav = document.querySelector('.navigation'); | |
| let menuOpen = false; | |
| menuBtn.addEventListener('click', () => { | |
| if(!menuOpen) { | |
| menuBtn.classList.add('open'); | |
| menuOpen = true; | |
| nav.classList.add('active'); | |
| } else{ | |
| menuBtn.classList.remove('open'); | |
| menuOpen = false; | |
| nav.classList.remove('active'); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment