Jump to content
Search Community

white space | scrollTrigger

Mo5 test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Solution

I noticed a few problems: 

  1. You're pinning an element INSIDE another pinned element. That won't work.
  2. You're using outdated files
  3. You're loading a ScrollTrigger that's not from GreenSock (AND the one from GreenSock). 
  4. You're nesting a tween with a ScrollTrigger INSIDE a timeline. You can't have the parent timeline's playhead control the tween's position AND the scrollbar position (it's logically impossible). You should apply the ScrollTrigger to the timeline itself, not the nested tween. 

Here's probably how I'd do it: 

See the Pen dyjYeBX?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Basic strategy: 

  • To create the overlap, put an "empty" tween at the end of the timeline so that all the animation stops before the end. The space should equal 1 / 3rd in this case (because you've got two sections, thus the third one is basically the next element below - the one that's coming in to overlap). 
  • Set a margin-top of -100vh on that next panel so that the normal document flow creates that overlap. The pinSpacing will push it down initially, of course. 
  • You'll probably want to set a bigger "end" value so that it takes longer for the animation to occur. I used "+=1000" but you can use whatever you want. 

There are other ways you could do it too. Like by setting up all your panels with position: absolute and do the entire animation in one timeline, including the overlapping one coming in at the end. The easiest way to do that is to literally ignore ScrollTrigger initially - just build your animation of the panels first. Get that looking good, and THEN hook it up to a ScrollTrigger to bolt it to the scroll position. 

 

I hope that helps!

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