Jump to content
Search Community

On resize, scrollTrigger break

Nacho90 test
Moderator Tag

Recommended Posts

Hello, maybe you can help me. I have this animation where the square changes color when it enters a section. Some are pinned and some are not.

The problem is: when I change the size of the screen, the starts and ends are offset and the square starts to change color on either side.
How can i fix this?

See the Pen LYQqKBB by NachoYama90 (@NachoYama90) on CodePen

Link to comment
Share on other sites

Your code is extremely difficult to understand in the sense that it goes against convention. You are nesting ScrollTriggers, which is big mistake. Reconstruct your code such that there are no nested scrollTriggers and see if that fixes it.

Link to comment
Share on other sites

Actually, I don't see any nested ScrollTriggers (at least in the typical sense we mean "nested" - in tweens that are inside of a timeline). 

 

I'm having a very difficult time understanding the problem you're describing, @Nacho90 - can you please simplify things and elaborate on exactly what the problem is? I don't know what "square starts to change color on either side" means. Either side of what?

 

Maybe instead of 5 sections, just try 2 or 3 and tell us specifically how to reproduce the problem. I didn't notice anything behaving strangely, but I'm sure I must be missing something. 

Link to comment
Share on other sites

Thanks for replaying.

I would try to be clear this time. I have some sections pinned and I need that the square ( when entering each section ) change its color.

The problem is:
When I resized the screen, It seems to be lost the markers references and the square doesn't change its color when entering a new section. ( it makes it random )  

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