Tsallaka zuwa abun ciki
Justice Tech School

Prefer CSS for Simple Effects

CSS transitions and animations run on the GPU and are smoother than jQuery animations. Toggle a class with jQuery and let CSS do the motion.

Example
.box { transition: opacity .3s; }
.box.hidden { opacity: 0; }

$('#b').toggleClass('hidden');

Exercise

Toggle a class.

$('#b').Class('hidden')

Quiz Test

Why prefer CSS transitions?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.