Jump to content
Search Community

Scrolltrigger pin last element

TerraHQ test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

thank you so much for your help, but in that case is going over my pin section which is not what I want.

what I want is that once the pinned section ends, you can keep scrolling normal.

I've made another codepen, that it's better but not exactly since there is a white gap, pls take a look on a large screen.

See the Pen YzvgONz by andresclua (@andresclua) on CodePen

pin_fixed_.png

Link to comment
Share on other sites

  • Solution

Hi,

 

That's because ScrollTrigger adds the pin space for the last element:

ScrollTrigger.create({
  trigger: panel,
  start: "top top", 
  pin: true, 
  pinSpacing:  (index === array.length - 1) ? true : false
});

That conditional logic is true for the final panel, so the pin space is added there. You just need pinSpacing: false for all the panels and your final panel should have a relative position.

 

Happy Tweening!

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