Jump to content
Search Community

Detect if page loaded past ScrollTriggers

Codetipi test
Moderator Tag

Recommended Posts

If you have a ScrollTrigger with an onEnter() method, it only runs if you literally scroll past the Start marker - which is expected.

 

But if you scroll to the end of a page and refresh the page, the onEnter event isn't triggered. If you take the Lazy Load example in the codepen (although it isn't really possible to test what I'm saying there), then refreshing at the end of the page would mean the images' lazy load method would never trigger. It would only happen if the user scrolled up past the start marker and then back down to trigger the onEnter method.

 

Is there an event similar onEnter() that would trigger if marker is "on Enter or if already past"? I can see trying to use ScrollTrigger for injecting content via infinite scrolling for example being problematic without something like this.

See the Pen YzydvBE by GreenSock (@GreenSock) on CodePen

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