Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMartin Guzman
11,573 PointsJavaScript vs CSS
Hi Community,
I have a question of what is the prefer solution to create transitions. I have noticed image galleries effects can be achieved similarly with JavaScript and CSS. But is there some sort of technology preference for this? My question is most toward response efficiency, SEO affectation if any and user experience.
Thanks
1 Answer
Michael Hulet
47,913 PointsIt's always best to use CSS animations and transitions if you can. This is for 3 main reasons:
- CSS transitions and animations are GPU accelerated, so they'll run visibly faster and smoother than JavaScript transitions and animations
- A user can turn off JavaScript, and they won't see your animation/transition if they do
- You have to write more platform-dependent code in JavaScript than CSS
Martin Guzman
11,573 PointsMartin Guzman
11,573 PointsThanks really appreciated it !
peichunliu
33,154 Pointspeichunliu
33,154 PointsThank you for the answer. Really helpful.