Jump to content
Search Community

Trying to animate pseudoclass - Cannot tween a null target

marius96 test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi all, I'm trying to make animation in which the :before pseudo-class of the box is being scaled down when I click that button, but I can't seem to be able to do that.

:before renders correctly,  is there any way to make this work? If I place it on the .main-page div, it's working, but that's not what I'm looking for.

The codepen link is the barebones version of what I'm trying to achieve.

See the Pen MWWmaXZ by make96 (@make96) on CodePen

Link to comment
Share on other sites

Hey marius, welcome to the forums.

 

In your pen I'm getting a "DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules" error. That's likely the issue.

 

In order to avoid the need for CSSRulePlugin, why not make the element a "real" element and not a psuedo-element?

 

P.S. Unless you need support for IE8, it's recommended to use the double colon :: for pseudo-elements.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...