Jump to content
Search Community

Why does "left" not work in codepen?

Ismail Hozain 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

I see your issue. The <a> element needs to be `position: relative` and you need to tween that element's `left` property. Currently you are tweening the button that is inside <a>. 

 

Refer to css docs for when "left" can be used:

Quote
  • When position is set to absolute or fixed, the left property specifies the distance between the element's left edge and the left edge of its containing block. (The containing block is the ancestor to which the element is relatively positioned.)
  • When position is set to relative, the left property specifies the distance the element's left edge is moved to the right from its normal position.
  • When position is set to sticky, the left property behaves like its position is relative when the element is inside the viewport, and like its position is fixed when it is outside.
  • When position is set to static, the left property has no effect.

 

See the Pen gXVgGG by jmca (@jmca) on CodePen

 

Edited by jmca
Adding pen
  • Like 4
  • Thanks 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...