Jump to content
Search Community

ScrollTrigger Infinite Scroll + Snap-scroll

mimei test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

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

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

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