Jump to content
Search Community

Assistance Needed - Issue with the pin-spacer div generated when using the ScrollTrigger with the property pin : true

N3O test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi !

 I am reaching out to seek assistance with a challenge I'm facing while using ScrollTrigger, particularly with the property pin: true.

 

Problem Description:
When utilizing pin: true, the ScrollTrigger generates a pin-spacer div. However, I've noticed that this generated div has a z-index value set to 'auto.' This is causing interference with certain parts of my code, preventing them from functioning as expected.

 

I would appreciate your guidance on how to resolve or work around this issue. Specifically, I am looking for a way to adjust the z-index value of the pin-spacer div generated by ScrollTrigger when using pin: true.

 

I appreciate your time and support in helping me overcome this challenge. If there are any additional details required, or if you need any extensive code snippet, please let me know.

 

Thank you for your assistance.

Link to comment
Share on other sites

  • Solution

ScrollTrigger has to create that wrapper element in order to prop things open and keep them from collapsing when the pinned element shifts to position: fixed, and it uses the same z-index you had set on the pinned element itself, so I'm not sure why it'd cause any issues for you. But you can actually create your OWN pinSpacer element wrapper and tell ScrollTrigger to use that instead (rather than it creating a new <div>) by passing it to the pinSpacer special property. 

...
scrollTrigger: {
  pinSpacer: yourWrapperElement,
  ...
}

See the docs

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