Share Posted July 1, 2020 Hi! I'm trying to replace the "pinned" images effect when scroll (like, those images "going up"), to a "fade in" effect in the images. So, if you scroll from the page top, the next image should appear with fadeIn, and so on with the other images, until the "scroll zone" (.main-wrapper in the Codepen) ends and then comes the "normal" scroll over the other content. I cannot find the way to do it, so I'll share a previous Codepen. See the Pen PoZJYZq by mikeK (@mikeK) on CodePen Link to comment Share on other sites More sharing options...
Share Posted July 1, 2020 Hey Jimmy. So essentially you want to fix all of the sections in place and transition between them. We show how to do that in one of the demos in the ScrollTrigger docs (this also loops from the beginning and end but if you take that part out it's practically the same): See the Pen rNOebyo by GreenSock (@GreenSock) on CodePen 2 1 Link to comment Share on other sites More sharing options...
Author Share Posted July 2, 2020 15 hours ago, ZachSaucier said: Hey Jimmy. So essentially you want to fix all of the sections in place and transition between them. We show how to do that in one of the demos in the ScrollTrigger docs (this also loops from the beginning and end but if you take that part out it's practically the same): Hi there! That worked like a charm. Had to change a little bit the HTML & CSS, but it's working. See the Pen KKVvrBY by jimmyadaro (@jimmyadaro) on CodePen Link to comment Share on other sites More sharing options...
Share Posted June 10, 2021 Hello everyone! Very nice topic!! Is there some way to launch this scroll trigger effect, just when the user scrolls down to some div trigger element ?? I mean, How can I start this effect after a user reaches a trigger div ? Because I don´t want this effect to start from the top of the page. Thanks!! Any advice will be helpfull!! Link to comment Share on other sites More sharing options...
Share Posted June 10, 2021 @Alex Lopez sure you can do that. I'd recommend going through the ScrollTrigger docs and demos to see how it's done. https://greensock.com/docs/v3/Plugins/ScrollTrigger https://greensock.com/st-demos/ Happy scrolling. 6 Link to comment Share on other sites More sharing options...
Share Posted June 11, 2021 Thanks Craig! The demos are really good for doing what I am looking for! Link to comment Share on other sites More sharing options...
Share Posted December 21, 2021 Hi, everybody. How could i add content (text or whatever) before images in that example?. Thanks. Link to comment Share on other sites More sharing options...
Share Posted December 21, 2021 Hello @misticvm It's always best to provide a demo with what you have tried yourself, because as the forum guidelines state, people helping here just don't have the time to craft custom code solutions for everybody coming into the forums. If you want it to work properly with scrollable content above the images, you'll have to rework the markup, CSS and JS logic a bit. Here's my suggestion: In the HTML markup move the main-wrapper__title-wrapper into the main-wrapper__panel-wrapper In the CSS styling set the elements that now are fixed or sticky to absolute, add a min-height to the main-wrapper__panel-wrapper and adjust the styling of the main-wrapper__title-wrapper a bit, so it still display correctly. In the JS add a ScrollTrigger that pins the .main-wrapper__panel-wrapper for the duration of the fading-in/fading-out of panels and use the wrapper as the trigger element for all ScrollTriggers so you can calculate the starts and end depending on that trigger to fit nicely. That could then look something like this (you can of course tweek the timing to your liking - just play around with the numbers and see what they do) ScrollTrigger.create({ trigger: '.main-wrapper__panel-wrapper', start: () => 'top top', end: () => "+=" + (panels.length - 1) * innerHeight, pin: true }); panels.forEach((panel, i) => { ScrollTrigger.create({ trigger: ".main-wrapper__panel-wrapper", start: () => "top top-=" + (i - 0.5) * innerHeight, end: () => "+=" + innerHeight, onToggle: self => self.isActive && show_next_hero_panel(panel) }); }); Since you are now pinning and thus the scroll-height is being adjusted by the pin-spacer, that also eliminates the need for setting the height of the .main-wrapper__panel-wrapper initially. Hope that will help. Happy scrolling and have a Merry Christmas time. See the Pen bGorrrm by akapowl (@akapowl) on CodePen 4 Link to comment Share on other sites More sharing options...
Share Posted December 21, 2021 Absolutely awesome, akapowl... Thank you very much. I spent all day yesterday trying to fix that behavior (no success... i finished frustrated). Right now i´m going to try implement your code. Quote It's always best to provide a demo with what you have tried yourself, because as the forum guidelines state, people helping here just don't have the time to craft custom code solutions for everybody coming into the forums. Sorry about that but that is why i mentioned the original example of this thread. My sincere apologies. Regards. 2 Link to comment Share on other sites More sharing options...
Share Posted December 23, 2021 Hi again. I have tried to adapt the code to a react application but it doesn´t work. I can´t see what is wrong See the Pen MWEEzgp?editors=0010 by misticvm (@misticvm) on CodePen Regards Link to comment Share on other sites More sharing options...
Share Posted December 23, 2021 You markers don't look the same as in this demo, so your you need to adjust your CSS and or HTML to match it. See the Pen bGooOov by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
Share Posted December 23, 2021 Actually when you are pinning the inner wrapper it would probably be neccessary to use the outer wrapper as the trigger for each of the fading-scrolltriggers as that one will keep scrolling while the inner will be pinned in place. I was wondering before why it worked the way I suggested it before, but didn't have enough time to dig into the setup in detail. Seems to work better then - and I hope this is all fine React-wise, as I am not very familiar with React and just added a ref to the outer wrapper in a similar manner as the inner wrapper has it. Does that work better for you? See the Pen PoJJVzy by akapowl (@akapowl) on CodePen 1 Link to comment Share on other sites More sharing options...
Share Posted December 23, 2021 42 minutes ago, akapowl said: Seems to work better then - and I hope this is all fine React-wise, as I am not very familiar with React and just added a ref to the outer wrapper in a similar manner as the inner wrapper has it. Looks good to me. For anyone else looking for React tips, be sure to check out our React guides. You can usually get away with only using 1 ref using the selector utility. https://greensock.com/react 2 Link to comment Share on other sites More sharing options...
Share Posted December 27, 2021 On 12/23/2021 at 8:23 PM, akapowl said: Actually when you are pinning the inner wrapper it would probably be neccessary to use the outer wrapper as the trigger for each of the fading-scrolltriggers as that one will keep scrolling while the inner will be pinned in place. I was wondering before why it worked the way I suggested it before, but didn't have enough time to dig into the setup in detail. Perfect. Now It seems is working without problems. Thank you again!. 2 Link to comment Share on other sites More sharing options...
Share Posted November 4, 2022 I'm also looking for the same component in the webflow but don't know how to do this with only jquery without react can any one help me with this? Link to comment Share on other sites More sharing options...
Share Posted November 4, 2022 Welcome to the forum @Hitendra There are examples above, which are not using React. So all you'd need to do is apply the changes mentioned further down the line to those examples. Also, there really is no need for jQuery as in those demos it isn't even any helpful. Here you go. See the Pen MWXeEEJ by akapowl (@akapowl) on CodePen 2 Link to comment Share on other sites More sharing options...
Share Posted November 11, 2022 @akapowl Thankzz alot that's a great help indeed. i just have one more issue i had placed two components with same effect (one after the other ) of sticky scroll trigger but when i'm done with the scrolling of the first one it fades out instead of scrolling up any help on that? Link to comment Share on other sites More sharing options...
Share Posted November 13, 2022 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 CodeSandbox 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/Nuxt/Gatsby or some other framework, you may find CodeSandbox easier to use. 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...
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