0
const itemLinks = document.querySelectorAll('.header-item')
const navHeader = document.querySelectorAll('.nav-menu')
for (let i = 0; i < itemLinks.length; i++) {
itemLinks[i].addEventListener('click', function(e) {
for (let i = 0; i < navHeader.length; i++) {
navHeader[i].classList.toggle('active')
}
navHeader[i].classList.remove('active')
})
}
.nav-menu.active{
display: block;
}
.nav-menu{
display: none;
}
<a href="#one" class="header-item header-item--one">menu one</a>
<a href="#two" class="header-item header-item--two">menu two</a>
<nav class="nav-menu">
<ul>
<li>Item one</li>
<li>Item one</li>
<li>Item one</li>
</ul>
</nav>
<nav class="nav-menu">
<ul>
<li>Item two</li>
<li>Item two</li>
<li>Item two</li>
</ul>
</nav>
Thanks Anderson thanks Ai bro solved!!
– Geniton Lima