DEV Community

loading...

Discussion on: Hamburger Menu in Minimal Javascript

Collapse
jacobmparis profile image
Jacob Paris Author • Edited

If we didn't care about updating the button text on each click, we could replace the event listener with the much simpler

sidebarTrigger.addEventListener('click', () => {
    sidebar.classList.toggle('isClosed');
});

But we do, so we can't 😥