Jump to content
Search Community

Unusual Behavior of Element when scrolling up.

IbraheemHaseeb test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I'm not quite sure what you mean by "displaces weirdly", but it seemed to play the same way when I scroll down or up. Are you saying it animates completely differently based on the direction you scroll? 

 

One thing I would DEFINITELY recommend is to always set all your transforms via GSAP rather than (or in addition to) in CSS. We explain why here. I noticed you're setting some tricky transforms only in CSS, and that can cause problems. Just add a gsap.set() call at the top of all your code where you set the transforms to ensure GSAP has each component exactly as you want them. 

Link to comment
Share on other sites

My best guess is that you have some kind of conflict in the way you set up your animations (like overlapping tweens where they're both telling the same properties of the same objects to go to different values at the same time), but I don't have time to sift through 600+ lines of JavaScript. If you still need some help, please isolate the issue in a minimal demo and we'd be happy to take a peek. 

Link to comment
Share on other sites

  • Solution

Ah, I glanced a bit more and the problem is that you've set up a bunch of matchMedia values that are non-exclusive. Put a console.log() inside each one and you'll see that several of them are getting called (appropriately). So yes, you're creating a bunch of overlapping/conflicting animations. You should make those matchMedia values mutually-exclusive (so only one matches at a given time). 

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