CosetteGirardot 0 Posted October 23, 2014 Report 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? Quote Link to post Share on other sites
Ingolme 1,020 Posted October 23, 2014 Report 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.