Jump to content
Search Community

Scrolltrigger: Overlap multiple sections with pin without "pushing away" previously pinned sections

Pageking test
Moderator Tag

Recommended Posts

Hi all,

 

I am trying to create an effect in which I can loop through all sections of a page and make them all overlapping. This is for a site where I don't know how many sections there are per page, since that can change.

 

The effect in my codepen is almost what I want, but ideally section 1, 2 and 3 should all be overlapping at the end of the page. I have tried using "pintype: ''transform" ad setting the pinspacing to true but to no avail.

 

Can anyone help me with a solution?

See the Pen yLQagom by wouter_pageking (@wouter_pageking) on CodePen

Link to comment
Share on other sites

Hello there, Pageking.

 

I'm not sure, if I 100% understand what your expected outcome is, but if you want them all to be visible at the end of scrolling, you'll need to make sure, you pin the first one longer than the second one, etc.

You can define the 'duration' of the pinning by setting the end value of your ScrollTriggers appropriately.

Here is a way you could calculate things, depending on the amount of sections you have and the index of each section.

 

This example will obviously only work while all your sections have the same height of 100vh - if that changed, you'd have to calculate the end of each ScrollTrigger depending on the amount of scrollable height created by the sections that come after each respective section.

 

I hope that will help get you started though.


See the Pen abQmJZV by akapowl (@akapowl) on CodePen


 

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