: If something can be achieved using CSS or JavaScript, which will render faster? I have two working solutions for hover navigation that I've built. One solution uses JS, one use CSS. My question
I have two working solutions for hover navigation that I've built. One solution uses JS, one use CSS. My question is, assuming a browser is JS-enabled, which solution will work faster?
I'll most likely opt for CSS anyway to avoid given non-JS browsers trouble, but I was curious. I'm not sure of a way to programatically test my solutions with the necessary resolution, but I presume this has been documented somewhere.
More posts by @Jamie184
3 Comments
Sorted by latest first Latest Oldest Best
I have been looking into similar issues, hence my clicking on the link. I learned a lot from this article on writing efficient CSS from Mozilla: developer.mozilla.org/en-US/docs/CSS/Writing_Efficient_CSS
Definitively use CSS pseudo-class :hover. It will be faster and more reliable.
I asked a similar question on stack overflow they said...
CSS ist for Style. JavaScript should be only for the application
logic... Generally you want to separate the application logic from the
design & animation. Beside that it performs much better especially on
mobile devices
stackoverflow.com/questions/10716885/responsive-design-method-for-collapsing-a-div
So if you can use pure CSS go with that
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.