moonIMD Posted May 23, 2023 Share Posted May 23, 2023 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 More sharing options...
moonIMD Posted May 23, 2023 Author Share Posted May 23, 2023 This is my codepen link: See the Pen OJBdREE by moonIMD (@moonIMD) on CodePen Link to comment Share on other sites More sharing options...
Rodrigo Posted May 23, 2023 Share Posted May 23, 2023 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 More sharing options...
moonIMD Posted May 23, 2023 Author Share Posted May 23, 2023 Thank you @Rodrigo! Then there isn't a way to pin the section (parent container) while making the stacking card effect work? Link to comment Share on other sites More sharing options...
Rodrigo Posted May 23, 2023 Share Posted May 23, 2023 Hi, With the current setup you have is a bit tricky. You'll have to set all your cards to an absolute position and animate them to their final positions. Something like this: See the Pen NWMZrbj by GreenSock (@GreenSock) on CodePen Hopefully that helps. Happy Tweening! Link to comment Share on other sites More sharing options...
CarlosG Posted July 15, 2023 Share Posted July 15, 2023 im looking for an example like the first one, cards stacked and when you scroll down the first one fades out and the next takes its place and so on until the last one has the biggest size and fades out any idea? Link to comment Share on other sites More sharing options...
GSAP Helper Posted July 15, 2023 Share Posted July 15, 2023 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 More sharing options...
CarlosG Posted July 15, 2023 Share Posted July 15, 2023 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 More sharing options...
Rodrigo Posted July 15, 2023 Share Posted July 15, 2023 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now