Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to toggle navbar using javascript

function classToggle() {
  const navs = document.querySelectorAll('.Navbar__Items')
  
  navs.forEach(nav => nav.classList.toggle('Navbar__ToggleShow'));
}

document.querySelector('.Navbar__Link-toggle')
  .addEventListener('click', classToggle);
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #toggle #navbar #javascript
ADD COMMENT
Topic
Name
2+3 =