Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Ismail Hozain

Why does "left" not work in codepen?

Recommended Posts

So my issue is that everything in my tweenMax is working except the left part - it is changing color and things are good but not the movement.Why is that happening?Thanks

 

See the Pen XzVvjO by ismailhozain (@ismailhozain) on CodePen

Link to post
Share on other sites

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

×