You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

22 lines
577 B

window.onload = function() {
(function() {
var hamburger = {
navToggle: document.querySelector('.nav-toggle'),
nav: document.querySelector('.links'),
doToggle: function(e) {
e.preventDefault();
this.navToggle.classList.toggle('expanded');
this.nav.classList.toggle('expanded');
}
};
document.addEventListener('click', function(e) {
if (e.target.className.includes("nav-toggle")) {
hamburger.doToggle(e);
} else {
hamburger.navToggle.classList.remove('expanded');
hamburger.nav.classList.remove('expanded');
}
});
}());
}