Jump to content
Search Community

Av9ry

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by Av9ry

  1. 7 minutes ago, SteveS said:

    I would look at the existing ways of integrating scrollTrigger with other smooth scrolling libraries like locomotive scroll or AsScroll

    Thank you for advice. The question remains the same, what exactly ScrollTrigger.refresh() does behind the scenes, and is it ok to call it on each frame?

  2. Hi. I have my own solution for smooth scrolling. It changes the translateY of the container element on scroll using request animation frame. I was looking for a way to make ScrollTrigger work, and what I did is put this line into my update() function that's being called each frame:

     

    ScrollTrigger.refresh();

     

    It works fine, and triggers all ScrollTrigger instances across my entire application correctly. No issues.

     

    The question is, what exactly the refresh method does, and is it okay to use it performance wise? I imagine if it calls getBoundingClientRect() it should be pretty bad to use it on each frame. The documentation says that it calculates startandendvalues, but what exactly are these values, and where do they come from — I have no idea. Would appreciate any help

     

    Thanks,

     

×
×
  • Create New...