function toggleMenu() {
$('.toggle_menu_button').click(function(e) {
e.preventDefault();
$(this).closest('.has_sub_menu').find('.toggle_menu').first().slideToggle(100);
$(this).toggleClass('open');
});
}
const el = document.getElementById('menu');
const className = 'active';
const toggleClass = () => {
if (el.classList) {
el.classList.toggle(className);
} else {
const classes = el.className.split(' ');
const existingIndex = classes.indexOf(className);
if (existingIndex >= 0) {
classes.splice(existingIndex, 1);
} else {
classes.push(className);
}
el.className = classes.join(' ');
}
};
document.getElementById('menu-toggle').addEventListener(
'click',
() => { toggleClass(); },
false,
);
document.getElementById('menu-close').addEventListener(
'click',
() => { toggleClass(); },
false,
);