Jump to content
Search Community

How to create layered pinning inside a centered div?

HiLuLiT test
Moderator Tag

Recommended Posts

i'm trying to create this demo inside a centered div

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


I basically  wrapped it with a wrapper  overflow:hidden div and changed scrollTrigger's pinning to the center of the viewport, but then I completely lost the layered pinning effect... 
also - I only managed to center the div horizontally with margin: 0 auto, how can I center it vertically? flexbox doesn't seem to work.
here's a demo -

See the Pen BazMOdL by HiLuLiT (@HiLuLiT) on CodePen

Link to comment
Share on other sites

On 11/14/2020 at 7:36 PM, HiLuLiT said:

I want to fade in/out the titles  on top of each slide- how can I achieve this?

Just add those animations to the timeline :) 

 

By the way I highly recommend learning more about the position parameter. In this case the "<" operator is equivalent to what you have.
Additionally you could write this code more efficiently by using a loop. I talk more about that in the most common GSAP mistakes and my article about animating efficiently.

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