ferriss Posted April 23, 2021 Share Posted April 23, 2021 Hi, Hopefully this is simple question to not need a reproduction. I have a Header with scrollTrigger: ScrollTrigger.create({ trigger: '.l-header--sticky', start: 'top top', endTrigger: 'html', end: 'bottom bottom', pin: true, pinSpacing: false, markers: true, scrub: 1 }); Half way down the vertical page, I have a horizontal scrolling section: gsap.to(container, { x: () => -(container.offsetWidth - document.documentElement.clientWidth) + "px", ease: "none", scrollTrigger: { trigger: container, pin: true, scrub: true, end: () => "+=" + container.offsetWidth } }); Now, this means the calculation for the header endTrigger is wrong as it's not taking into account the horizontal vertical scroll. Cannot see anything in the docs to refresh this calculation? Thanks. Link to comment Share on other sites More sharing options...
Solution akapowl Posted April 23, 2021 Solution Share Posted April 23, 2021 Hey @ferriss 24 minutes ago, ferriss said: Now, this means the calculation for the header endTrigger is wrong as it's not taking into account the horizontal vertical scroll. Cannot see anything in the docs to refresh this calculation? If your ScrollTriggers appear in your code in this order, then yeah, your first ScrollTrigger can't know the pinning duration of any ScrollTrigger created later on. What could help is setting a refreshPriority of -1 to your ScrollTrigger with the html-endtrigger, so it will on refresh get considered after your horizontal-pinning ScrollTrigger (which by default has a refreshPriority of 0). https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.sort() Give it a shot and let us know if it helps. 1 Link to comment Share on other sites More sharing options...
ferriss Posted April 29, 2021 Author Share Posted April 29, 2021 Perfect, that's sorted it. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now