Modern browsers run CSS transitions on the GPU compositor thread, making them significantly smoother than JavaScript-driven animations — especially on mobile. Understanding when to use CSS transitions (delegated to the browser) versus jQuery's .animate() (JavaScript-driven) helps you build performant UIs.
When to Use CSS Transitions
Use CSS transitions when the animation is triggered by a class change, the property is transformable (transform, opacity), and you don't need JavaScript to calculate intermediate values. jQuery can trigger CSS transitions simply by adding or removing a class with .addClass().
When to Use jQuery .animate()
Use .animate() when the target value is computed at runtime (e.g., scroll position, user input), when you need fine-grained queue control or callbacks, or when you must support browsers without CSS transition support (legacy IE).
- CSS transitions — GPU-accelerated, ideal for
transformandopacity - jQuery .animate() — flexible, queue-aware, runtime values
- Hybrid: add class → CSS transition plays, callback via
transitionend - jQuery UI adds easing + class animation via
.switchClass()
For the smoothest 60 fps animations, animate only transform and opacity — these properties do not trigger layout recalculation (reflow) or paint, only compositing.