Jump to content
Search Community

Pin section and change tabs on vertical scroll

cgeorgiev test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hello everyone,

Can you help me with this - when I reach What We Do section I need to pin it and scroll through the four tabs on left and then unpin and go to Latest Insights section.

Thanks a lot!

 

image.thumb.jpeg.0115d37c95a6cb0381c455cda0faa3cd.jpeg

Link to comment
Share on other sites

What have you tried already? We love to see minimal demo's, that way we can see your thought process and thus better help you understand the tools! If you're new to GSAP check out this awesome getting started guide https://gsap.com/resources/get-started/. For your effect just focus on the animation and remove ScrollTrigger, you want to create an animation on scroll, so you first have to create the animation part before you can do the ScrollTrigger part, check out video below which is a great illustration how to work with ScrollTrigger

 

 

 

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

 

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

that loads all the plugins. Just click "fork" at the bottom right and make your minimal demo

 

Using a framework/library like React, Vue, Next, etc.? 

CodePen isn't always ideal for these tools, so here are some Stackblitz starter templates that you can fork and import the gsap-trial NPM package for using any of the bonus plugins: 

 

Please share the StackBlitz link directly to the file in question (where you've put the GSAP code) so we don't need to hunt through all the files. 

 

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

Hi @cgeorgiev welcome to the forum!

 

Check the link https://gsap.com/resources/get-started/ posted in the previous reply, this would be the starting point I would recommend anyone new to GSAP give a once over. It is not directly the solution you're looking for, but the beauty of GSAP is that you can build anything you like, the only thing holding you back is your own creativity. So I would first focus on the basics of the tools.

 

You could look for something similar, but personally I would start with something you have build your own that way you can really learn what the tools are capable of. https://codepen.io/GreenSock/collections/ here are all types of pens you could look for inspiration and below something that has the features you're looking for, but not the same layout. Again everything in GSAP starts with an animation, so I really encourage you to start with that and don't worry about ScrollTrigger. When you still need help be sure to post a minimal demo of what you've already tried and we be happy to point you in the right direction. Hope it helps and happy tweening! 

 

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

  • Like 1
Link to comment
Share on other sites

Lets tackle one questions at a time. 

 

The best thing to do when working with ScrollTrigger is to remove it! This seems counter intuitive, but ScrollTrigger is just animating something on scroll, so just focus on the animation at first and only when you're happy with the animation add ScrollTrigger back in. This way you can focus on one part at a time and it will save a lot of headache when debugging. 

 

What have you tried already? We love to see what you can come up with, that way we can see your thought process and thus better help you understand the tools!I see a tween for the element .line-2 but I see no element in your html?

 

I've copied the logic from my post on stacking cards, because this is kinda the same effect. (Please read the post below it goes over some key points) Again it is so important to first focus on the animation you want to happen, so now with each content block animating in and out try adding the change of color of each tab index element, so that the correct one turns red when the correct element comes in. See how far you can come and shows us with an updated demo what you've tried when you get stuck. Hope it helps and happy tweening! 

 

See the Pen wvZeePx?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Still, remove ScrollTrigger. Make is so much easier to see what is going on. I've removed your tween that had "+=500" this was add ing 500 seconds to the animation and now it seems to just add the class to each at a time. 

 

I'm not a fan of adding classes in tweens, I rather have GSAP handle all the chasing of properties. 

 

What I would do now is add labels to points your ant to scroll to. and then use the scrollTo plugin and the .labelToScroll() function https://gsap.com/docs/v3/Plugins/ScrollTrigger/labelToScroll()/ to scroll to those labels you'e created. 

 

See the Pen dyLRQLz?editors=1010 by mvaneijgen (@mvaneijgen) on CodePen

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