Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get an a:hover color via javascript without hovering on the element?

I want to sniff the color which a link would become if I hovered over it without actually hovering over it. The reason I want to do this is so I know what to change it back to using animate as the colour can be set via various skins which would be applied dynamically. Can I do this using javascript or jquery ( or is there any other way to do it ) ?

Edit: I already have implemented this using CSS transitions but I need the javascript for IE9 and below

like image 273
byronyasgur Avatar asked Jan 26 '26 03:01

byronyasgur


1 Answers

No, this isn't possible unfortunately: you can use getComputedStyle() to retrieve information about pseudo-elements (::before/::after), but not the :hover pseudo-selector.

References:

  • window.getComputedStyle() compatibility.
like image 65
David Thomas Avatar answered Jan 28 '26 16:01

David Thomas