Tip 51 | Leverage CSS for Animations |
In this tip, youâll learn how to use CSS for animations.
The last tip isnât even a JavaScript tip. Instead, itâs a tip about when to stop using JavaScript.
The key to writing readable code is to use the best tool for the job. JavaScript used to be the best tool for animations. In fact, there were entire libraries dedicated to using JavaScript to create drop-down menus or to animate slide-in elements.
Itâs much easier now. CSS is replacing JavaScript for simple animations. Thatâs great. Now you donât have to worry about using the right timeouts or calculating odd-size constraints. CSS will take care of all that for you. Youâll still need JavaScript for more complicated animations, but for most ...
Get Simplifying JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.