Jump to content
Search Community

Krix

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Krix

  1. When using Observer in React, it does not prevent the scroll or touch event at the beginning before page content is loaded. So when I scroll or touch before the observer is created, the page will scroll down. Is there any way to know when the observer prevents default is active to not let the user scroll? Tks for spending time on my topic.

    This situation happens in mobile devices.


    You can watch the video I demo at here: https://drive.google.com/file/d/18FOc1qc-5xf-tIKMLJGDFu6-0UG4E_w9/view

     

    And I also attach the example project link: https://codesandbox.io/s/blissful-moore-s9qzj5?file=/src/pages/page1/index.tsx

    ezgif.com-video-to-gif.gif

  2. 6 hours ago, Rodrigo said:

    Hi,

     

    This seems more related to the way touch devices handle scroll.

     

    Try using normalizeScroll and see how it goes:

    https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.normalizeScroll()

     

    gsap.registerPlugin(ScrollTrigger, ScrollToPlugin);
    
    ScrollTrigger.normalizeScroll(true);

    Also you could try a more specific snap configuration in your ScrollTrigger instance (scroll down until the snap section and see the object configuration). Basically you want to snap to an array of values [0, 1] so it goes to the start or end point of the ScrollTrigger instance:

    https://greensock.com/docs/v3/Plugins/ScrollTrigger

     

    Hopefully this helps.

    Happy Tweening!

    Thanks for your response, I tried the snap with values [0,1] but it has a delay time (even though I set the delay time as 0) and it does not scroll immediately.

  3. My case is when the user scrolls the first time, no matter whether short or long, the animation must be finished. And revert the animation when going backward.

    But somehow when I scroll hard, the heading is lagging.

    You can test it on a mobile device and see the difference.

     

    video: https://drive.google.com/file/d/17V6gMXfMVGqWCzZppKC5TwgKmZBSbC_g/view?usp=drivesdk

     

    Codesanbox link: https://codesandbox.io/p/sandbox/charming-hill-ss2m8s

     

     

  4. My expect is when the user scroll to the lottie section, it will keep the viewport at that section and play like 50 frames for 1 scroll, continue until the end of lottie frame. Then the scroll behavior will back to normal. If user enter back it will animating in backward way.

     

    use can see the example project here: https://codesandbox.io/s/prod-fire-3jyss6?file=/src/LottieAnimation.jsx

×
×
  • Create New...