Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
qvstudio

ScrollTrigger Pin make element stick to top

Go to solution Solved by akapowl,

Recommended Posts

Hi I'm struggling with make the Photography part stick to top until the two sections below reach the end point. How can I set the end value of the ScrollTrigger to match the end of the sections below?

 

ScrollTrigger.create({
  pin: '.phototitle',
  pinSpacing: false,
  start: 'top top',
  markers: true,
  scroller: '.container',
});

 

sectionkopie.jpg

Link to comment
Share on other sites

  • Solution

Hello there @qvstudio.

 

You can set an endalongside an endTrigger.

With the endTrigger you can target the section you want the end to trigger on and with the end you can define at which point in the viewport for that section the ScrollTrigger is supposed to end.

 

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

 

 

From the ScrollTrigger docs:

 

endTrigger String | Element - The element (or selector text for the element) whose position in the normal document flow is used for calculating where the ScrollTrigger ends. You don't need to define an endTrigger unless it's DIFFERENT than the trigger element because that's the default.
  • Like 5
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.
×