Jump to content
Search Community

Accordion + horizontal scroll issue

Clou test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

That's because you're fundamentally changing the layout/positioning of everything by opening/closing that accordion. Remember that ScrollTrigger pre-calculates the start/end positions for all ScrollTriggers so that it's extremely performant while scrolling. So for example, let's say that trigger for the horizontal section is calculated to start at a scroll position of 500...but then you open the accordion which PUSHES everything down by 100px. Well now that start position should be adjusted to be 600 instead of 500. 

 

All you need to do is force ScrollTrigger to refresh all of its calculations by putting ScrollTrigger.refresh() in your onComplete: 

See the Pen VwEJyaV?editors=0010 by GreenSock (@GreenSock) on 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.
×
×
  • Create New...