Jump to content


ScrollToPlugin exclude margin

Go to solution Solved by GreenSock,

Recommended Posts



Most of the time I create HTML blocks with margins, as they collapse so they work well together when using a CMS. However, when using ScrollToPlugin it ignores the margin as it's outside the box-model, is there a way that I can include margin without using offsetY as offsetY will then not play ball with blocks that are full-bleed without margins.



Link to comment
Share on other sites

  • Solution

How about just plugging the margin into the offsetY? Like

offsetY: gsap.getProperty("#element", "marginTop")



If you still need help, it'll significantly increase your chances of getting a solid answer if you include a minimal demo (like a CodePen). 👍

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