I respect the readability of this trick that Mikael Ainalem posted over on Reddit:
It’s a one-liner that toggles the category on the <physique> so you’ll be able to mock up totally different states and toggle between them on click on.
<physique onclick=”this.classList.toggle(“lively”);”>
Could possibly be on any factor as nicely!
CodePen Embed Fallback
This could be a large factor. See “The Energy of Altering Courses” as a living proof. Even if you happen to aren’t a lot of a JavaScript particular person, classList is maybe the one API it’s best to know.
The put up Physique Toggle appeared first on CSS-Tips. You may help CSS-Tips by being an MVP Supporter.
0
Subscribe to MarketingSolution.
Receive web development discounts & web design tutorials.
Now! Lets GROW Together!