Jump to content
Search Community

ScrollTrigger matchmedia bug? scroll state is not reverted

LeO_on test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello! Sorry for my english, i will use google translator. 
Found strange behavior on the official script example 
 

When I scroll down a bit and resize the screen, the current scroll and animation should return to their previous state. This works, but when I remove the optional section with class "gray" from the bottom, the scroll jumps to the top of the page when i resize from mobile to desktop and vice versa.
Why? How do i get the scroll to be saved. Attached video in low resolution.
I wanted to recreate timelines and sub-timelines for mobiles and desktops, but i dont like this jump to the top of the page. Therefore, now I make one instance of the trigger, and when the screen changes, I reset the timeline with clear() and progress(progress), but did not figure out how to create sub-timelines (with add(subtimeline)). 

Thanks!

 

 

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

Link to comment
Share on other sites

Although, logically, scroll should not revert, because timelines duration may be different?
Then how to make a separate version of main timeline with sub-timelines for mobile and desktop and save scroll position?

Link to comment
Share on other sites

I found an old example on the internet  

See the Pen d951058e0b04421dd0b0cc0ce2bbce25 by osublake (@osublake) on CodePen

 

how to do that (different timelines on mobile and desktop)? how to make subtimelines to this main timeline? because after binding to the scrollTrigger main timeline, subtimelines behave incorrectly after resize, maybe i need to somehow reset them?

Link to comment
Share on other sites

  • Solution

First of all, that original demo was broken because it was linking to the beta version of ScrollTrigger which had a bug (and is now fixed). You may need to clear your cache and reload. 

 

I didn't quite understand what you're asking - your last demo seemed to show well how you can grab the progress of a particular timeline, create a new one, and re-assign the progress to match where it was previously. 

 

If you're still having trouble, please provide a minimal demo with as little as possible, just enough to show the particular issue you're struggling with and we'd be happy to take a look. 

Link to comment
Share on other sites

13 hours ago, GreenSock said:

First of all, that original demo was broken because it was linking to the beta version of ScrollTrigger which had a bug (and is now fixed). You may need to clear your cache and reload. 

 

I didn't quite understand what you're asking - your last demo seemed to show well how you can grab the progress of a particular timeline, create a new one, and re-assign the progress to match where it was previously. 

 

If you're still having trouble, please provide a minimal demo with as little as possible, just enough to show the particular issue you're struggling with and we'd be happy to take a look. 

I updated the cache and nothing has changed - it also throws me to the top of the page after page resize.
About the last demo: I can add tweens to the main timeline, but I can’t create sub-timelines (via add(subtimeline)), do I need to reset their behavior somehow? 
ok, i'll make a demo, but later. Thanks!

Link to comment
Share on other sites

14 hours ago, GreenSock said:

First of all, that original demo was broken because it was linking to the beta version of ScrollTrigger which had a bug (and is now fixed). You may need to clear your cache and reload. 

 

I didn't quite understand what you're asking - your last demo seemed to show well how you can grab the progress of a particular timeline, create a new one, and re-assign the progress to match where it was previously. 

 

If you're still having trouble, please provide a minimal demo with as little as possible, just enough to show the particular issue you're struggling with and we'd be happy to take a look. 

although after updating the cache, my project started working, although I used the current version of ScrollTrigger, strange, thank you!

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