Jump to content
Search Community

ScrollTrigger stops working properly after I open and close a modal!

MalinO test
Moderator Tag

Recommended Posts

I have a problem with ScrollTrigger, it stops working properly after I open up and close a modal on my single page application.

I have build my application with React. The only thing I have found as a solution is to call the ScrollTrigger.refresh(). I have tried that but I can't get it to work. Can you give me some examples on how I should use it? The modal pops-up after I have clicked on a button. I don't think that I'm the first one who have had this problem. Really need your help!

 

Best Regards, 

Malin

Link to comment
Share on other sites

  • 1 year later...

I was running into this too and it turned out my issue was that I was calling `tl.scrollTrigger.enable(false);` before I restored the user's scroll position. I moved `tl.scrollTrigger.enable(false);` after the scroll position was restored and that solved it!

Here's my Codepen demo:

See the Pen a0a170062ea8f3395b40c5063bb59037?editors=1010 by ericdjohnson (@ericdjohnson) on CodePen


 

image.thumb.png.1f728916251c8fa7962e97baa27420ed.png

 

 

Edited by Eric Llama Johnson
Remove wrong screenshot
  • Like 2
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...