+ 3

Is it a good practice to use javascript instead css for animations?

scope of css and javascript

5th Jun 2017, 12:14 AM
ShßvÄm KûmÄr Ðwïvëðß
ShßvÄm KûmÄr Ðwïvëðß - avatar
4 Answers
+ 7
It's adviced to use Css instead JS for all you can do by this way, for two mainly reasons: - JS could be unavailable or disabled by user - Css effects and animations are more efficient than handling them with JS in most of case, as JS execution is synchrone on a mono thread/processus: by the way, the more you have to handle stuff with JS, the more you will overload the process and get inneficiency, in addition to add page load time, rather than Css transitions and animations are handling directly by the browser, so optimize DOM interaction and memory consumption and most importantly, uses the GPU to improve performance, letting your other JS code having more ressources :P
5th Jun 2017, 2:36 AM
visph
visph - avatar
+ 2
it's safe to use CSS, Javascript may be disabled on the user's browser.
5th Jun 2017, 4:04 AM
Bahha┣
Bahha┣ - avatar
+ 1
Yes, it's really usefull to create javascript animations. For exemple, when the player win a game in a web videogame, it's easy to create a js animation.
5th Jun 2017, 12:26 AM
Apple