Jump to content
Search Community

CTA

James702 test
Moderator Tag

Go to solution Solved by ZachSaucier,

Recommended Posts

  • Solution

Hey James and welcome to the GreenSock forums. 

 

If you inspect the CTA button you can see that they are using two extra elements (in their case pseudo-elements) to create the colored rectangle behind the text. I'm not sure why they need two elements as I'd use a single element. 

 

All you need to do is position an element to the left of the text (with overflow: hidden; on the parent) then when it's hovered translate it in the x direction to the "normal" location behind the text. Then when the button is unhovered you translate it to the right. If someone hovers over it again before the animation completes then you restart the animation from the beginning (killing off the old animation).

  • 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...