Toggle active class won't be toggled off, when going into another nav > submenu

Viewed 29

I have made a menu with dropdown submenu and inside the submenu there is a submenu.

Everything works fine, except the active class, when I click on another nav, it won't be toggled of again.

Also is it possible to close the sub menu inside the submenu, when going into another submenu.

function removeActiveClasses() {
    pageNavigationParent.forEach(function(el) {
        el.classList.remove("active-sub");
    });
}

https://codepen.io/Jv2711/pen/mdLeNVR

0 Answers
Related