0

I know that the hover state of an element can be triggered by adding a class that contains the styling for the element's hover state, but what if the styling involves ::after styling?

Ao C
  • 127
  • 1
  • 9
  • 1
    Possible duplicate of [How do I simulate a mouseover in pure JavaScript that activates the CSS ":hover"?](http://stackoverflow.com/questions/17226676/how-do-i-simulate-a-mouseover-in-pure-javascript-that-activates-the-css-hover) – Scott Aug 22 '16 at 19:19
  • Okay, so it's not possible basically unless a class is created and manually added or removed so I guess I'll need to investigate how to duplicate ::after properties and translate those into a class. – Ao C Aug 22 '16 at 19:25
  • 1
    how about adding styling for hover and after ... .addedclass:hover::after { /* css here */ } – yezzz Aug 22 '16 at 19:27
  • 1
    No need to duplicate stuff, just add a class selector where you have your `:hover`. ie `.selector li:hover, .selector li.hover { ... }`. This is really easy if you use Sass/Less, etc, or a preprocessor like [cssnext](http://cssnext.io/) to get a hold of the self selector `&`. – Scott Aug 22 '16 at 19:28
  • Thanks for the suggestions guys, I can only style by dynamically injecting CSS so don't think these would work, ended up creating a new class that I will now trigger on or off via JS. – Ao C Aug 22 '16 at 20:40

0 Answers0