Jump to content
GreenSock

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

ScrollTrigger cause subsequent element overlap/cover previous one once unpinned

Go to solution Solved by OSUblake,

Recommended Posts

I use ScrollTrigger to pin an element:

 const trigger = ScrollTrigger.create({
      trigger: q('#map-pin-trigger'),
      start: '-=48px top',
      end: 'bottom center',
      pin: q('#map-container'),
      // markers: true,
 })

 

However, once I scroll to the end of the trigger & it unpins, the subsequent element would be covered up by the previous unpinned item (it goes under the previous item), it looks like this (part in red square shouldn't cover up the chart):

26962739_ScreenShot2022-01-24at16_32_59.thumb.png.6b8960424589c5f3d4b154dc45ba01d3.png

 

I added a CodePen demo.

 

Any advices would be appreciated. Thanks. I feel it has something to do with pinSpacing but I couldn't make it work. 

 

If you could help me understand why this could happen that'll be great too!

 

 

See the Pen YzEXVzW by noahsong (@noahsong) on CodePen

Link to comment
Share on other sites

It's very hard to say what any ScrollTrigger issues are without a minimal demo. Thanks!

 

Link to comment
Share on other sites

On 1/24/2022 at 5:25 PM, OSUblake said:

It's very hard to say what any ScrollTrigger issues are without a minimal demo. Thanks!

 

Hi @OSUblake, I just added a CodePen demo.

Link to comment
Share on other sites

  • Solution

Thanks for demo. Very minimal and easy to understand!

 

So I'm assuming you're looking for it to behave like this? I just needed to manually calculate the end value.

 

See the Pen ExbjvOM by GreenSock (@GreenSock) on CodePen

 

 

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