1

I am making some Web Apps that need a quick response and have a significantly tight refreshing time. All I want is to save memory and CPU Load. My Question is: Which is prefferable CSS or Javascript/jQuery in styling things like:

  1. Visibility
  2. Animation

I mean both are achievable from both respects and both seem ok. But I would like to be effective from the Structure. Any help will be appreciable.

Please be honest with the core-level reason if possible.

Thanks.

And to those who marked this question duplicate:

I am not looking for iPad Native Systems only. I am looking all aproaches.

tika
  • 7,135
  • 3
  • 51
  • 82
  • 3
    I would say css3 is probably always better than js when it comes to efficiency – Huangism Jul 30 '14 at 15:31
  • 2
    Without expensive and heavy external JS libraries, animation is like re-inventing the wheel. CSS3 provides native support for it, so I'd choose that. – Kodlee Yin Jul 30 '14 at 15:32
  • @Huangism Would you mind explaining in few lines? – tika Jul 30 '14 at 15:32
  • 4
    If it's styling, try to use css as much as possible. Javascript is for behaviour and shouldn't be used to style elements. Of course, this is not always possible, and some scenarios might require javascript for more advanced styling. – Jazzwave06 Jul 30 '14 at 15:32
  • 1
    CSS can take advantage of hardware acceleration, I'm not sure if JS can. At least not without extra work if so... – Novocaine Jul 30 '14 at 15:32
  • 1
    @xDNP It's one of those things I know by heart but I can't explain it in a way that is good enough for an answer. Fear not as someone will post an answer that is more dtailed than I can imagine – Huangism Jul 30 '14 at 15:34
  • 1
    Too long of an article for me to read at work but seems pretty relevant: http://davidwalsh.name/css-js-animation – DasBeasto Jul 30 '14 at 15:34
  • relevant: http://stackoverflow.com/questions/9336778/have-there-been-measurements-on-how-much-faster-css-is-than-javascript-for-codin – SW4 Jul 30 '14 at 15:36
  • 1
    I'd add the [fastest JavaScript animation library](http://www.greensock.com/gsap-js/) I've come across comes pretty close to CSS performance in case you want to see a [comparison](http://www.greensock.com/transitions/). – Novocaine Jul 30 '14 at 15:40
  • The answers for the duplicate question are generic. – Antti Haapala -- Слава Україні Jul 30 '14 at 16:06

0 Answers0