ashirrr Posted February 28 Share Posted February 28 I have read that Scrolltrigger.refresh(true) maximum waits for 200ms to refresh with its 'safe' parameter. Is there a way to specify the time period i.e Scrolltrigger.refresh(500) or something? Link to comment Share on other sites More sharing options...
mvaneijgen Posted February 28 Share Posted February 28 Hi @ashirrr welcome to the forum! As far as I know, this is not possible, but you can use gsap.delayedCall(0.5, myFunction) https://gsap.com/docs/v3/GSAP/gsap.delayedCall()/ and then then in myFunction call ScrollTrigger.refresh(); If you still need help please provide a minimal demo and also explain what you're trying to do, so that we can prevent the classic xyproblem.info Hope it helps and happy tweening! 1 Link to comment Share on other sites More sharing options...
Rodrigo Posted February 28 Share Posted February 28 Yeah @mvaneijgen is right that is not possible. The number you're seeing there (200ms) refers to the internal debouncing feature ScrollTrigger has in order to not run all the logic of the refresh method if the refresh method was called less than 200ms before. For example let say that you manually call the refresh method somewhere in your code, with a button click. If the user resized the window 150ms before that button click ScrollTrigger will check that the previous refresh call timer is running soto speak so it'll restart said timer and wait for another 200ms to run all the refresh logic. Here is a simple explanation of how debouncing works: https://www.freecodecamp.org/news/javascript-debounce-example/ Hopefully this clear things up. Happy Tweening! 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