Skip to content
Discussion options

You must be logged in to vote

Thanks for the heads up! we were able to fix the issue on our own. Enjoy your vacation! 😊

export function smoothScrollToTop() {
    return new Promise((resolve) => {
      const scrollStep = () => {
        if (window.scrollY === 0) {
          resolve();
        } else {
          requestAnimationFrame(scrollStep);
        }
      };
      
      window.scrollTo({ top: 0, behavior: 'smooth' });
      scrollStep();
    });
  }```
  

out: (next, infos) => {

   var tl = gsap.timeline({
     onComplete:  async() => {
      if(window.scrollY !== 0){
        await smoothScrollToTop();
      }
      next();
     },
   });
   tl.add(new Out());
 },
 ```

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@daun
Comment options

daun Aug 26, 2024
Maintainer

Comment options

You must be logged in to vote
0 replies
Answer selected by diegoviador
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants