javascript

mail@pastecode.io avatar
unknown
javascript
2 years ago
570 B
2
Indexable
Never
let menutoggle = document.querySelector('.menutoggle');
let navigation = document.querySelector('#navigation');
menutoggle.onclick = function(){
    navigation.classList.toggle('active')
}
let list = document.querySelectorAll('.list');
function activeLink(){
    list.forEach((item) =>
    item.classList.remove('active'));
    this.classList.add('active');
}
list.forEach((item) =>
item.addEventListener('click',activeLink));

function openClose() {
    var sidebar = document.getElementById("navigation");
    sidebar.classList.toggle("nav-hidden");
}