Search code examples
javascriptcsshovermouseovermouseout

Using mouseover and mouseout instead of :hover


For a project I want to emulate the css :hover pseudoclass, with a .hover class, that I add/remove on mouseover and mouseout events.
The question is, how much is this affect performance, and how big the difference is?
Here is an example: link


Solution

  • The performance depends on the individual user's computer. You will most likely not see any difference whatsoever on any machine unless JavaScript is disabled. You may wish to consider including some CSS that will will compensate for this in the unlikely event that the user has JavaScript disabled.