Jump to content
Search Community

xoxoxoxo

Members
  • Posts

    93
  • Joined

  • Last visited

Posts posted by xoxoxoxo

  1. I have a use case where my container has pointer events prop, so clicks can go through from parent to an ancestor div. Currently, this prop doesnt get copied over to the pinned node. I think It would be harmful to add this property to _propNamesToCopyThoughts?

  2. If the unmount happens after route has completed then it doesn't really matter if you're using useLayoutEffect or not.

     

    See the log below. Unmount triggers after the route has completed which means the initial page has already rendered.

     

    I still think the rollback on refresh should respect browser's scrollRestoration property before calling scrollTo method.

     

    image.png.a74e7db8cb282b280fc537b6909d6a41.png

  3. I do kill ScrollTrigger on an individual level rather than all on route change. The return function gets called when component unmounts.

     

    React.useEffect(() => {
    if (ref.current == null) return;
     
    const st = ScrollTrigger.create({
    trigger: ref.current,
    pin: true,
    start: 'top top',
    pinSpacing: false,
    });
     
    ScrollTrigger.refresh(true);
     
    return () => st.kill();
    }, [pageStyle]);
  4. I've disabled all scroll controls Nextjs ships with so i'm pretty convinced that it's not the framework.

     

    I tried fiddling with ScrollTrigger's source code and adding an early return here, which does not retain the scroll position on route changes. This fixes the issue I'm having on route changes however I can't understand where and why it's being called during runtime.

     

    Why is it calling scrollTo? The value arg seems to be the y position of the previous route in my case. Is there a source with comments to understand this better?

     

    sc: function sc(value) {
    if (arguments.lengthreturn;
    return arguments.length ? _win.scrollTo(_horizontal.sc(), value) : _win.pageYOffset || _doc[_scrollTop] || _docEl[_scrollTop] || _body[_scrollTop] || 0;
    }
  5. I have awkward behavior in nextjs on route changes. When the route changes successfully, I explicitly call `window.scrollTo(0,0)` to reset the scroll position of the browser.

     

    However, on a new page route I'm creating a scroll trigger and also refreshing it which yields into a negative side effect of retaining the previous route's scroll position. does ScrollTrigger.refresh(true) retain the scroll position internally?


    Thanks.

  6. well, the onComplete or onStart only fires when the panel touches the edge of the viewport. I need more granular control and ideally would like to fire events relative to fixed item's position. Is this possible with the event callbacks you mentioned above?

     

    i.e, if the fixed item is placed 20px below the viewport's top my onComplete should fire when the panel's end is around 80-90%

     

    Here's a minimal demo that changes rand color but it's edge to edge: 

    See the Pen OJRRRpo?editors=0010 by nullhoooook (@nullhoooook) on CodePen

  7. I have a bunch of panels which are absolutely positioned. I'm trying to detect onLeave or onActive flag on these panels so I can change the color of an external element that is position fixed. For ex, menu..

     

    How would this work on divs that aren't positioned normally? I have created a minimal demo where I'm iterating through the panels to create triggers and the markers are laid out inaccurately.

     

    Basically I'm trying to change the color of the fix div when the panel leaves/enters the viewport.

    See the Pen gOwMBvp?editors=1010 by nullhoooook (@nullhoooook) on CodePen

  8. I'm trying to achieve an effect like this, the panels auto roll but also are controllable from mouse scroll.

     

    I've tried to re-create this using the wrap() function however there is always a "gap" between. Also, I had to turn off `autoRefresh` flag because it was resetting every time it repeated.

     

    How do I fix the gap and How do I also control it from the mouse?

    See the Pen BaLNMeq?editors=1010 by nullhoooook (@nullhoooook) on CodePen

  9. I have a page with position absolute panels. I see Scrolltrigger adds overflow-y on body as an inline style. Why?

    Also, the overflow-y doesn't get removed if I navigate to a different page.

    Shouldn't killing the Scrolltrigger instance remove the inline style? I do kill all the instances when navigating to a new page.

    image.png.3addceb5e9e554bbedd8082a9d4892b3.png

  10. Yes, I meant "export". 

    Looks like NextJS excludes everything inside node_modules from being transpiled through babel.  Anyone who comes across this issue has to use next-transpile plugin which transpiles all node_modules. 

     

    I will use the provided non-module ScrollTrigger plugin as workaround.

    Does this mean webpack won't treeshake gsap or scrolltrigger? 

  11. I'm using NextJS and I want to utilize it's treeshaking capabilities. What would be the proper to way to import gsap? Inside the docs I see exampes but I have questions:
     

    I import gsap like this:
     

    import gsap from 'gsap';
    import { ScrollTrigger } from 'gsap/dist/ScrollTrigger';
    
    if (process.browser) {
      gsap.registerPlugin(ScrollTrigger);
    }

    My bundle sizes seems large doing it this way.

     

    I see diff ways to import gsap though and not sure which one to follow:


    import { gsap } from 'gsap';
    import gsap from 'gsap';
    import gsap from 'gsap/all'

     

     

×
×
  • Create New...