Jump to content
Search Community

GSAP Scrolltrigger start position breaks on dom changes

Aftenposten Data test
Moderator Tag

Recommended Posts

Im creating widgets that get embedded in another site. This site has ads and other stuff that gets injected above my widget so my scrolltrigger start position gets messed up. 

I could use ScrollTrigger.refresh() but this causes a major UX flaw for iOS user as its stop the page from scrolling.
My temporary solution is to do a refresh when user is not scrolling. Not optimal.

Is there a solution im not aware of? Does GSAP plan to somehow solve this in the future?

Minimal demo:

See the Pen qBGXedy by ringz (@ringz) on CodePen

Link to comment
Share on other sites

Are you saying that you may have things causing a page reflow/resize WHILE the user is actively scrolling on an iOS device AND you want to force a ScrollTrigger.refresh() DURING that process without stopping the momentum-scroll? I don't think that's feasible. You could, however, set it up so that it waits until scrolling is done, and THEN does the ScrollTrigger.refresh().

 

Is that what you're looking for? 

Link to comment
Share on other sites

Hi, sorry for late response!

Cassie: Yes, on IOS if I do a ScrollTrigger.refresh() the scroll momentum will stop. (I can start scroll again, but the UX-experience is bad when scrolling just stops on iOS)
 

The page will reflow/resize after my gsap animation is initiated. It can be because of slow loading images, lazy loading and other embed above my widgets.
The solution mentioned above is actually what Im doing now: Wait 200ms after scroll and ScrollTrigger.refresh()


I was hoping this could be solved without me setting up event listeners. Or If you had a plan to solve the iOS issue

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