Jump to content


Target SVG text on rollover on a card by card basis

Go to solution Solved by GreenSock,

Recommended Posts

I can change the color of each SVG 'card' but I'd like to target just the text within each SVG 'card'. Because I have a lot of cards to target, I don't want to give each text item within the SVG a unique identifier. I just want to be able to rollover each card and have GSAP only target the text of the current card. Thanks for the help.

See the Pen rNwMJYy by sandalwoodsh (@sandalwoodsh) on CodePen

Link to comment
Share on other sites

  • Solution

Perhaps like this?:

function onMouseEnter(obj) {
 gsap.to(obj.querySelector("text"), { fill: "#9234eb"});


  • Like 2
Link to comment
Share on other sites

Thanks for the solution and quick reply, Jack.

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.