Jump to content
Search Community

rnrh

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by rnrh

  1. I have a fromTo() that I want to execute on load, and then another fromTo() that I want to execute using ScrollTrigger. My pen has the intended functionality, but looking at my code, it seems like there must be a more elegant way to combine these into a timeline. I looked at batch, and I'm not sure that's the right approach for this effect, but I am pretty to new to gsap in general.

     

    Any guidance would be greatly appreciated.

    See the Pen ZEejejq by rnrh (@rnrh) on CodePen

  2. @Rodrigo, @elegantseagulls@Cassie thanks for your continued help and patience with this. I think I will reach out to the smooth scroll library maintainer and see if they have any recommendations.

     

    I don't disagree with you on the smooth scroll stuff, fwiw. Unfortunately, I don't have a say over it for this project. If I find a good solution I'll come back and post it here for posterity.

     

    Thanks again for your help.

  3. I am having an issue I have seen described in other contexts but haven't found a solution for. My project is using the Next.js framework for react, Smooth Scrollbar, and ScrollTrigger. I have a .to() with a scrollTrigger object inside that is in a <Navigation /> component. The text at the top of the page is just supposed to pin itself and scroll with the window, but it only works in some cases. I think I'm not fully understanding some lifecycle thing here. All these methods of reproducing my errors are also commented at the top of the index.js file in the sandbox

     

    1. With Smooth Scrollbar enabled, the scrollTrigger object stored in the <Navigation /> component, and the <Navigation /> component imported and nested in the main functional component, the effect does not work after refreshing the page. If you go into the scrollTrigger object in the <Navigation /> component and update one of the values (change the 'end' value to a different number) this will trigger a hot reload without refreshing the browser. If you scroll back to the top and scroll down, you will see the effect is now working.
    2. If you comment out the entire useEffect() hook in the main index.js component this will disable Smooth Scrollbar. If you save the file and refresh you will see the effect working as intended, without having to trigger a hot reload, but now there is no Smooth Scrollbar.
    3. If you reset the sandbox to the original state, uncomment the HTML in the main index.js components return, comment out the <Navigation /> component right above it, save and then refresh, you will see that the effect works on load, with Smooth Scrollbar, without having to trigger a hot reload, but now I've lost the ability to nest components.

     

    CodeSandbox link

    Direct link to results in browser (A little easier for refreshing)

     

    Any help would be greatly appreciated. I'm out of ideas at this point.

     

     

×
×
  • Create New...