CosetteGirardot Posted October 23, 2014 Share Posted October 23, 2014 In trying to make a "talkbubble" styled div- box change colors completely upon being clicked, I ran into a problem of getting the :before pseudo element that I'm using (to shape the arrow for the talkbubble) to actually change colors with the rest of the element. My script is http://jsfiddle.net/petiteco24601/3xuuq2fx/. When I couldn't get it to work, I did some research and it seems what/how to control pseudo-elements is a question that most web developers seem shaky about. For the most part, a lot of what I found was basically saying that there's no way to really force javascript on a pseudo element, since the pseudo element doesn't REALLY exist. However, with more research, I found things like http://css-tricks.com/pseudo-element-animationstransitions-bug-fixed-in-webkit/ andhttp://stackoverflow.com/questions/2610497/change-an-inputs-html5-placeholder-color-with-css/2610741#2610741 that say that those bugs were fixed and it is possible with some browsers to use javascript on pseudo elements. What's the actual deal? How extensively can a person control pseudo elements? Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2014 Share Posted October 23, 2014 You can control it with CSS without any problem. You'll have to make a real element if you want to use Javascript on it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now