Jump to content
Search Community

ScrollTrigger pin broken by align-items display flex

sprhnns test
Moderator Tag

Recommended Posts

Hi @sprhnns welcome to the forum!

 

What do you expect the result to be? To me this all seems to work fine. I do note that you're using some old GSAP/ScrollTrigger version, which is not recommended, but even on the new version this result seems logical to me, the element you want to pin pins as soon as the trigger element is met and stops pinning when the end is reached

 

Loading the following scripts in codepen will get you the latest version 

https://unpkg.co/gsap@3/dist/gsap.min.js

https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js

 

  • Like 1
Link to comment
Share on other sites

Hello everyone!
Thank you very much for your thoughts on this one.

Indeed the issue here is not an issue 🙈. I was completely blind while trying to copy this thing to codepen.
Since it was "stuck" on the bottom, due to the start and alignment in the middle, I assumed this was the same problematic behavior that I was seeing in my local dev.
But as you said – it did exactly what it was supposed to do.

The problem though was something else.
I was initializing the scroller 2 times, didn't notice though. Once with an event listener 

document.addEventListener('readystatechange', (event) => {

and once just in a regular file.
For whatever reason, this did work just fine unless this flex align was on the outer container? The pinned item "jumps" or disappears to the end.

Actually in the codepen it's not even working at all when adding the event listener – so this is the issue
As seen here

See the Pen WNYrZwa by sprhnns (@sprhnns) on CodePen



Maybe you could explain this, but anyways – that was the problem.

Thank you!

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