Jump to content
Search Community

Pinning a section + Vertical Stacking Cards effect

moonIMD test
Moderator Tag

Recommended Posts

Hello,

 

I am having some issues with pinning a section (making it fixed) while having a stacking card effect inside the pinned section.

The pinned section has an image on the left and the stacking cards on the right. I want that whole section to be fixed as it scrolls to that section.  The image on the left should still be show while there is a stacking card effect on the right. However, when the parent container is pinned, the stacking card effect isn't working. When I remove the pinning codes (for the parent container), the stacking card effect is working fine.

What is the issue? How can I pin a section while having the stacking card effect inside that pinned section?

 

I am using these urls for the stacking cards effect:

https://greensock.com/forums/topic/33597-stacking-cards-overlap/

See the Pen WNzBrdz by Mohsen-Khakbiz (@Mohsen-Khakbiz) on CodePen


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

 

Thank you!

See the Pen OJBdREE by moonIMD (@moonIMD) on CodePen

Link to comment
Share on other sites

Hi,

 

One solution is to create the cards ScrollTrigger instances first and then create a ScrollTrigger that pins the image and set it's end value using the previous method, in order to set it's end to the last card's end point:

ScrollTrigger.create({
  trigger: ".image",
  start: "top 10",
  end: (self) => self.previous().end,
  pin: true,
  markers: true,
});

Here is a fork of your codepen:

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

 

Finally you were using very old versions of GSAP, so I strongly recommend you to update to the latest ones.

 

Hopefully this helps.

Happy Tweening!

Link to comment
Share on other sites

  • 1 month later...

Hi @CarlosG and welcome to the GreenSock forums!

 

It's pretty tough to troubleshoot without a minimal demo - the issue could be caused by CSS, markup, a third party library, your browser, an external script that's totally unrelated to GSAP, etc. Would you please provide a very simple CodePen or Stackblitz that demonstrates the issue? 

 

Please don't include your whole project. Just some colored <div> elements and the GSAP code is best (avoid frameworks if possible). See if you can recreate the issue with as few dependancies as possible. If not, incrementally add code bit by bit until it breaks. Usually people solve their own issues during this process! If not, then at least we have a reduced test case which greatly increases your chances of getting a relevant answer.

 

Here's a starter CodePen that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

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

 

If you're using something like React/Next/Vue/Nuxt or some other framework, you may find StackBlitz easier to use. We have a series of collections with different templates for you to get started on these different frameworks: React/Next/Vue/Nuxt.

 

Once we see an isolated demo, we'll do our best to jump in and help with your GSAP-specific questions. 

Link to comment
Share on other sites

i dont had a working demo yet. its React/Next/Vue/Nuxt just a website but figuring out how to do it, with the cards stacked by default then when scroll reach the cards first one zoom out  a little bit and fades out, just liek the top example but backwards this one is when you scroll down the cards get stacked

Link to comment
Share on other sites

Hi,

 

Unfortunately without a minimal demo there is nothing we can do.

 

If you search in the forums you'll find a few different examples of stacking cards with ScrollTrigger, it would be as simple as combine them in order to get the animation you're after.

 

Unfortunately we don't have the time resources to create an example by guessing what you're trying to achieve.

 

Happy Tweening!

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