DEV Community

Discussion on: Creating A NavBar drawer with HTML/CSS.

Collapse
 
perpetual_education profile image
perpetual . education

Cool explorations! Over the years, we've built these so many ways!!! It's crazy. You can even use a checkbox now - and skip the JavaScript completely - but on the subject of JavaScript: check out this approach

With this style of "event delegation" (having one listener and then doing different stuff depending on what is clicked) - you can really simplify the whole thing. What do you think?

Collapse
 
perpetual_education profile image
perpetual . education

Here's a more fleshed out example too. : )