-webkit-transition/-moz-transition vs jQuery
This is a two-part question:
What applied style takes priority: a -webkit-transition
rule in CSS or a similar $.css()
method in jQuery?
Is there any point to including a -webkit-transition
rule in my stylesheet if I am also using the .css
method in j开发者_运维技巧Query? That is, will adding -webkit-transition
make the animation any more efficient in Safari/Webkit browsers if I am including the jQuery rule anyways? (This goes for -moz-transition
too).
Or is it best to use solely jQuery?
Thanks!
I say its good to use both even if they do the same. If someone comes along with javascript disabled, there is good chance they will still see the intended transitions via CSS if they are on latest browsers to supports transitions and such. Just my point of thought on this.
Edit: Okay, so my droopy eyes mistook the question as CSS or JQuery. But still, would be nice idea to do it in CSS file and JQuery animation. No real benefit I see to do webkit in JQuery.css
Depending on what rule you are using, the native browser CSS equivalent would be the better choice, since it could be hardware accelerated.
It looks like Chrome 9+, Safari 5 and Firefox 4 all support hardware accelerated CSS transforms. jQuery is catching up and it looks like it will be hardware accelerated eventually.
精彩评论