mimei Posted May 31, 2022 Share Posted May 31, 2022 Hello, I really appreciate using the GSAP that lets even a beginner like me make something awesome. I have a very elementary question on customizing ScrollTrigger script. I'd like to use "ScrollTrigger Infinite Scroll" script (see URL) with CSS snap-scrolling. I modified the "ScrollTrigger.create" part (the last part) like this: ScrollTrigger.create({ trigger: 'section', onEnter: () => { createPanel(panelNum++); ScrollTrigger.refresh(); }, onLeave: () => { createPanel(panelNum++); ScrollTrigger.refresh(); }, Then I noticed that it generates a new section only when I snap to/from the existing section, not the newly created one. I need the newly created ones to be a trigger to make an infinite snap-scrolling. I'm aware that my question is so rudimentary, but I'd be very grateful if someone could help me in making the Infinite Scroll "snappable". See the Pen WNQmvPK by kdbkapsere (@kdbkapsere) on CodePen Link to comment Share on other sites More sharing options...
mimei Posted May 31, 2022 Author Share Posted May 31, 2022 I created the demo (which doesn't work as I expect). See the Pen MWQGRdQ by mimei_maudet (@mimei_maudet) on CodePen I'd like the newly created section to trigger events so that one can scroll infinitely. Do you have any idea to fix the problem? (I also noticed the creation of a section flashes the screen...) Link to comment Share on other sites More sharing options...
Solution GreenSock Posted June 4, 2022 Solution Share Posted June 4, 2022 How about this?: See the Pen abqKxdw?editors=0010 by GreenSock (@GreenSock) on CodePen When it gets within 1/6th of the panel height from the bottom, it adds a new one. Snapping is also dynamically updated accordingly. Is that what you were looking for? Link to comment Share on other sites More sharing options...
mimei Posted June 10, 2022 Author Share Posted June 10, 2022 Hello Jack, Thank you very much for your help! Yes, that's what I have been looking for. Thank you again. 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