Cartos Posted June 9, 2022 Share Posted June 9, 2022 Hi All, Horizontal scrolling section overlapping the dynamic added content. I tried with ScrollTrigger refresh as well, but it didn't work for me either. Check here my codepen url : See the Pen VwQEBvJ by cartos (@cartos) on CodePen You can see the problem in full view mode using this url : Please help where I am making mistake. See the Pen VwQEBvJ by cartos (@cartos) on CodePen Link to comment Share on other sites More sharing options...
Cassie Posted June 9, 2022 Share Posted June 9, 2022 Hi there I'm not seeing an issue, could you explain a little further? Thanks Link to comment Share on other sites More sharing options...
Cartos Posted June 10, 2022 Author Share Posted June 10, 2022 Thanks for reply Cassie, Problem is horizontal content sometimes overlapping the dynamic content. Here I have recorded the video, it might help you https://drive.google.com/file/d/1-OA9ieiEV1cbmUweuX6XJmz7kbOVjGF8/view Link to comment Share on other sites More sharing options...
Cartos Posted June 13, 2022 Author Share Posted June 13, 2022 Hi did you get some time to check my video. I have some dynamic sections which are populating from response. And in last I have horizontal sections as well which are scrolling on scroll. Now the problem is, sometimes horozontal scroll is not waiting for dynamic sections to be populated and appearing before/overlapping dynamic sections. Link to comment Share on other sites More sharing options...
GreenSock Posted June 13, 2022 Share Posted June 13, 2022 That looks to me like you are dynamically loading data in AFTER the page loads and it is affecting layout (throwing off the start/end positions of the ScrollTriggers), so make sure you call ScrollTrigger.refresh() after you're DONE affecting layout. Perhaps here: fetch("https://reqres.in/api/users?page=1") .then((res) => res.json()) .then((json) => setUserData(json.data)) .then(() => ScrollTrigger.refresh()); // <- HERE! Does that help? 3 Link to comment Share on other sites More sharing options...
Cartos Posted June 13, 2022 Author Share Posted June 13, 2022 Thanks, thats all I wanted. But it is a solution to part of the problem. There is also a problem with the horizontal section. In the first section, I am populating the data from the API, which width can be anything as I am populating all the data in one row. Now after populating you can see that the last section of the horizontal bar is sometimes not visible and sometimes it is not moving to the left as expected. Link to comment Share on other sites More sharing options...
Cassie Posted June 13, 2022 Share Posted June 13, 2022 Are you sure you're calling ScrollTrigger.refresh() afterwards and updating the width of that section? I noticed you're using selector text and normal variables too, which is usually a bad idea in React. We have this guide here which may help you. 1 Link to comment Share on other sites More sharing options...
Cartos Posted June 13, 2022 Author Share Posted June 13, 2022 34 minutes ago, Cassie said: Are you sure you're calling ScrollTrigger.refresh() afterwards and updating the width of that section? I am calling ScrollTrigger.refresh() only after json response. I do not know how we can calculate the width of that section as that will be increasing on length of response data. Link to comment Share on other sites More sharing options...
Cassie Posted June 13, 2022 Share Posted June 13, 2022 This pen should help - See the Pen ExQOwpw by GreenSock (@GreenSock) on CodePen 1 Link to comment Share on other sites More sharing options...
Cartos Posted June 14, 2022 Author Share Posted June 14, 2022 Thanks for your help. I updated my pen and horizontal sections look working now. But sometime last section is flickering. See the Pen VwQEBvJ by cartos (@cartos) on CodePen 1 Link to comment Share on other sites More sharing options...
Cassie Posted June 14, 2022 Share Posted June 14, 2022 I can't see the flicker. Do you have steps to reproduce it or any more information? Link to comment Share on other sites More sharing options...
Cartos Posted June 14, 2022 Author Share Posted June 14, 2022 Hold on to the last section, a little before of end, around 95%. The last section tries to go left automatically and thats where it flickers Link to comment Share on other sites More sharing options...
Cassie Posted June 14, 2022 Share Posted June 14, 2022 There's no issue for me! Looks a ok. Maybe you're looking at it in an iframe or on a bad connection. Kapture 2022-06-14 at 11.34.01.mp4 Link to comment Share on other sites More sharing options...
GSAP Helper Posted June 14, 2022 Share Posted June 14, 2022 We love helping with GSAP-related questions, but unfortunately we just don't have the resources to provide free general consulting, logic troubleshooting, or "how do I recreate this cool effect I saw on another site?" tutorials. Of course anyone else is welcome to post an answer if they'd like - we just want to manage expectations. You can post in the "Jobs & Freelance" forum for paid consulting, or contact us directly. Otherwise, if you've got a GSAP-specific question just post that here along with a minimal demo and we'd be happy to take a look. Link to comment Share on other sites More sharing options...
Cartos Posted June 14, 2022 Author Share Posted June 14, 2022 5 minutes ago, Cassie said: There's no issue for me! Looks a ok. Maybe you're looking at it in an iframe or on a bad connection. Thank you so much @Cassie Great help so far. I got the solution. It was network connection 1 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