Skip to content

Instantly share code, notes, and snippets.

@eyecandy91
Forked from Bradcomp/toggle-menu.js
Created April 24, 2019 12:38
Show Gist options
  • Save eyecandy91/39cebe7f0f559b4388543e46b05e336d to your computer and use it in GitHub Desktop.
Save eyecandy91/39cebe7f0f559b4388543e46b05e336d 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');
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment