I want to be able to add hover
to the classList
of an element to force trigger hovering styles.
In JS, how can I detect all :hover
styles and add a hover
class to have those same styles?
For example, if the class is:
a:hover {
}
I want to add:
a:hover, a.hover {
}
I want to write a JS script that makes the conversion I mentioned above, adding the a.hover
class styles for ALL :hover
. How can I do this?
NOTE: I don't have access to the CSS. It's loaded in externally so I can't just add to it. This is why I want to make a script that runs on start to do this.