50projectsIn50days – Day 14: animated navigation
A navigation bar inside the html is the responsible of hosting the menu li. But, for the example is not necesarry to use explain more about that.
This nav has an event listener which listen for a click. When it happens it will be added elelment active which is the responsible of change the style.
const toggle = document.getElementById('toggle') const nav = document.getElementById('nav') toggle.addEventListener('click', () => nav.classList.toggle('active'))