TRIIX Posted October 6, 2021 Share Posted October 6, 2021 I got an Issue with the ScrollTrigger Method "onUpdate": I am trying to "snap" the sections on a Scroll Update (I don't want to use snap: because the user has to stop scrolling to trigger the snap and it should happen onUpdate). So If I am in section1 and trigger onUpdate and if direction === 1, then it should scrollIntoView to Section2: ScrollTrigger.create({ markers: true, id: 'section1', trigger: '.section1', start: 'top 350px', end: 'top 350px', endTrigger: '.section2', onUpdate: ({ direction }) => { if (direction === 1) { section2.scrollIntoView({ behavior: 'smooth', block: 'center' }); } }, }); The problem I am having, is that the behavior: 'smooth', is interfiering with ScrollTrigger and it's not scrolling to the center. I tried to change the direction (if direction === -1) and it is scrolling to the block, but wouldn't make sense to use. My Question is, if there is an even simpler solution or if its a bug, how can I fix it? Thanks in advance :D Link to comment Share on other sites More sharing options...
Cassie Posted October 6, 2021 Share Posted October 6, 2021 Heya! It's hard to tell what the issue is without a minimal demo. But we do have a plugin for this - you may have more success with it.https://greensock.com/docs/v3/Plugins/ScrollToPlugin 4 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