Jump to content


margin auto

Moderator Tag
Go to solution Solved by GreenSock,

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

Help plz.

Inner block jumps to a horizontal alignment without animating itself there.
Initially I was running both animations simultaneously and so I thought that perhaps the inner block may not know the horizontal dimensions to calculate margin auto if the outer block is animating its 'left' attribute, but it turns out that the animation doesn't work even after the outer block finished animating.

Thanks for the help!

See the Pen vgoiL by samaraiza (@samaraiza) on CodePen

Link to comment
Share on other sites

  • Solution

Because "auto" isn't a number, so GSAP doesn't have values to interpolate between. In other words, what's halfway between 10px and "auto"? :) You could try calculating the number you're looking for using things like offsetLeft and offsetTop.

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.