Dave
Dave

Reputation: 645

Which is the most efficient on iOS - CSS3 or jQuery animations?

Do iOS devices render the CSS3 animations/transforms/transitions more smoothly than if I were to use jQuery to do the same animation?

Upvotes: 3

Views: 1084

Answers (2)

Rich Bradshaw
Rich Bradshaw

Reputation: 72975

CSS3 transitions are massively faster on iOS and should be used whenever possible in preference to the old way of doing things.

If you combine transitions with transforms then you get the benefit that things are hardware accelerated, meaning that animations are very fluid, especially when many are happening at once.

Of course, you'll need to test it to see, but it's fairly easy to write a function that allows you to abstract this away. Here's one I wrote a while back - not the greatest, but it's an easy way to start off: http://css3.bradshawenterprises.com/legacy/

Upvotes: 3

Keith Walton
Keith Walton

Reputation: 5364

jQuery can be very slow on iOS, and it would probably use CSS3 anyway after it detected the brower's capabilities. jQuery is not necessarily fast, just cross-browser compatible. Writing HTML, CSS, and JavaScript targeted to a browser will always be faster.

Upvotes: 0

Related Questions