olr Posted November 29, 2023 Share Posted November 29, 2023 I found a card solution that suits me and I'm trying to expand it. In each of my cards there will be a large amount of text that is scrollable. Is it possible to connect this general scroll to also scroll the content with text before moving to the next tab? Scrolls down for card1 -> scrolls .card-content of card1 -> enters card2 -> scrolls .card-content of card 2 -> enters card 3..... See the Pen LYqJXej by Rafa-Olejarz-the-flexboxer (@Rafa-Olejarz-the-flexboxer) on CodePen Link to comment Share on other sites More sharing options...
ryan_labar Posted November 30, 2023 Share Posted November 30, 2023 You'll likely want to do this with transforms on the inner text layer with overflow: hidden (instead of scroll), and adding those to the tween (as a timeline). This way you can control how the user moves through the data. With a traditional scrollbar, as you have in the current version, it's really tough to control the inner scroll, as I'm sure you found out. Link to comment Share on other sites More sharing options...
Toso Posted November 30, 2023 Share Posted November 30, 2023 hi @olr maybe you looking for something like that? containerAnimation is great for creating this kind of animation, also to hiding the scroll bar is a good idea as @ryan_labar already mentioned it will look better See the Pen WNjaxKp?editors=0010 by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
olr Posted November 30, 2023 Author Share Posted November 30, 2023 thanks for your answers! I updated my code (codepen in the first entry) Yes, sliding seems to be a better idea than scrolling, but I can't achieve it. Basically I can't achieve two things: 1. Scrolling/moving the content itself - when I tried to do this, I was moving the entire element, not its content. 2. I don't know how to stop the next tab from entering until the content moves to the bottom For example, I added opacity there, it ends when the next tab is at the top, I would like the opacity to be done on scrolling to 0 and only then the next tab appears. Ultimately, it is not supposed to be about opacity, but about moving/scrolling the content down. Link to comment Share on other sites More sharing options...
ryan_labar Posted December 1, 2023 Share Posted December 1, 2023 Definitely rough, but checkout my fork of your pen. I think this can/should be done in a single gsap timeline with just one scrollTrigger instance per card... You'll definitely want to tweak the math/timing to fit your needs but it's a working example: See the Pen zYemMpv?editors=0010 by ryan_labar (@ryan_labar) on CodePen 3 Link to comment Share on other sites More sharing options...
GreenSock Posted December 1, 2023 Share Posted December 1, 2023 This might also be helpful: See the Pen bGRdvMy by GreenSock (@GreenSock) on CodePen 2 Link to comment Share on other sites More sharing options...
olr Posted December 2, 2023 Author Share Posted December 2, 2023 thank you for your answers and help! now I know how to do it thanks! Link to comment Share on other sites More sharing options...
olr Posted December 4, 2023 Author Share Posted December 4, 2023 However, I can't quite deal with it, I guess my problem is that I will always have a view of 100vh and the content that needs to be scrolled will fill its center. I wasn't able to transfer your examples to my project, as if another tab was always added before the entire content was shown. I need to stop the tab if the content is on scroll and move the text in the middle of the window to the very bottom. If you could take a look it would be great, I've tried many times and I could never show all the content before the next tab. I keep fighting and this is just an example of what I mean: See the Pen LYqMGWj by Rafa-Olejarz-the-flexboxer (@Rafa-Olejarz-the-flexboxer) on CodePen Link to comment Share on other sites More sharing options...
Rodrigo Posted December 5, 2023 Share Posted December 5, 2023 Hi, If you have sections with height less than the height of the screen you can wrap them inside another element and pin that parent element as shown in these demos: See the Pen LYMYYEL by GreenSock (@GreenSock) on CodePen See the Pen qBLRzVX by GreenSock (@GreenSock) on CodePen See the Pen ZEVpqjb by GreenSock (@GreenSock) on CodePen Hopefully this helps. 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