Mobile app version of vmapp.org
Login or Join
Jamie184

: 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

@Jamie184

Posted in: #Css #Javascript #PageSpeed

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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Jamie184

3 Comments

Sorted by latest first Latest Oldest Best

 

@Goswami781

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

10% popularity Vote Up Vote Down


 

@Miguel251

Definitively use CSS pseudo-class :hover. It will be faster and more reliable.

10% popularity Vote Up Vote Down


 

@Si4351233

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme