dmk,
var btnMenu = document.querySelectorAll('.btn-menu'),
subMenu = document.querySelectorAll('.sub-menu'),
i, btn, sub;
for (i = 0; i < btnMenu.length; i++) {
btn = btnMenu[i];
btn.addEventListener('click', menuOpen(i));
};
function menuOpen(i) {
return function (event) {
event.preventDefault();
[].forEach.call( btnMenu , function(el,a) {
a == i ? (el.classList.toggle('btn-menu--active'), subMenu[a].classList.toggle('sub-menu--show')) : (el.classList.remove('btn-menu--active'), subMenu[a].classList.remove('sub-menu--show'));
});
};
};