Jump to content
Search Community

Remove delay of scroll with batch method of ScrollTrigger

MrWhiteSky test
Moderator Tag

Recommended Posts

Hi,


I have a problem when I use batch method from scrollTrigger, when I begin on the top of the page and I scroll to the bottom all is working well, but if I refresh a page (and the scroll position is keeping), or if I use an html achor (exemple.com/home#bloc3), or if I directly set a position with scrollTop method, In all this cases I need to wait all the "bloc" create before, have finished the "stagger" time before to see the animation (see the codepen, you will see some seconds before the animation start).


Have you an idea to prevent this problem ?


Thanks

 

See the Pen gOrpZrm by florian-richard (@florian-richard) on CodePen

Link to comment
Share on other sites

Hey MrWhiteSky and welcome to the GreenSock forums. The "long delay" is because technically all of the elements before that point need to be batched in as well. Since you don't have a batchMax set, it does it all in one batch. 

 

One solution is to just set a batchMax:

batchMax: 3 // or some other number

Alternatively you could change ScrollTrigger's configuration to limit callbacks on the ones before the scroll position:

See the Pen KKzpbEE?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 3
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...