Answer by Krzysztof Antosik for Close menu when link is clicked
You must use a loop because querySelectorAll returns an array.const navToggle = document.querySelector('.nav-toggle')const navLink =...
View ArticleAnswer by Dan Heberden for Close menu when link is clicked
You're trying to add an event listener to a collection of nodes (querySelectorAll for .nav-link vs querySelector for .nav-toggle). You can either iterate over the collection and add your click event...
View ArticleClose menu when link is clicked
I have an off-canvas menu that flies out when a toggle-button is clicked - so far so good. All menu links share the same class name (in this case .nav-link). I need the menu to close when any of the...
View Article
More Pages to Explore .....