Last active
August 26, 2021 16:49
-
-
Save viankakrisna/ff73359398849b64b6f1 to your computer and use it in GitHub Desktop.
toggle class without jQuery
This file contains 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
document.getElementById('menu-button').onclick = function() { | |
document.getElementsByTagName('header')[0].classList.toggle('menu-open'); | |
document.querySelector('div.content').classList.toggle('menu-open'); | |
document.querySelector('nav').classList.toggle('menu-open'); | |
return false; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment