Share Posted January 27, 2016 Hi, everyone. I read the spec and know that I can tween the css pseudo-elements (':before', ':after') using CSSRulePlugin.getRule What if I have several elements with the same class name and all of them have pseudo-elements and I want to tween them individually? Is this possible? I tried the CSSRulePlugin.getRule function, and the tween would change all the elements' pseudo-elements. Thanks in advance. Link to comment Share on other sites More sharing options...
Share Posted January 27, 2016 Hello daniel_pan, And welcome to the GreenSock Forum! Do you have an example of the code you were trying, and the CSS selector being used? In CSS if you just target using :before or :after, and it is a general CSS selector rule. It will target all :before or :after elements, or in this case the generated content in the DOM. You would need to be more specific in your CSS selector rule, either by using a class, id or tag along with the pseudo-element. Which has to do with general CSS relating to CSS Specificity and what exactly you are directly targeting in the DOM with your CSS selector. Resources: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity#directly-targeted-elements https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/Selectors Also a codepen example of what your trying would be a big help so we can see your code in context. here is a video tut on how to create a codepen example Also keep in mind that with GSAP to animate pseudo-elements you must use the old syntax of single colon ( : ) and not the new double colon ( :: ) for pseudo-elements in the CSS3 spec. Thanks 4 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