Jump to content
Search Community

djarosz

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by djarosz

  1. Hi @elegantseagulls,

     

    Thank you for getting back to me so quickly and looking into the issue. In my codepen example I'm using the disable() functionality on the click event of the "back-to-top" button and then onComplete of the scroll using enable() functionality. 

     

     

    // Scroll to top Button
    const scrollTopBtn = document.querySelector('.btn-top');
    
    var enableGsap = function () {
    	ScrollTrigger.getAll().forEach(test => test.enable());
    }
    
    scrollTopBtn.addEventListener('click', function () {
      
      ScrollTrigger.getAll().forEach(test => test.disable());
        gsap.to(window, {
            duration: 1.5, 
            scrollTo: {
              y: 0,
              x: 0,
              autoKill: true
            },
          onComplete: enableGsap
        });
    });

     

    Let me know if I'm doing something incorrectly.

     

    Thanks!

    • Like 1
  2. Hello GSAP Team,

     

    I'm new to Scroll Trigger and having issues trying to scroll back to the top of the page.  I've created a snapping section in the middle of the page that acts like a "road block". That works well.

     

    At the bottom of the page, I have a button that scrolls you user back to the top of the page when clicked on. Here lies the issue. Once the scroll reaches the top of the page, it then starts scrolling back down to the snapping section.

     

    I need it to stay at the top with out it scrolling back down. 

     

    Thanks!

     

    See the Pen abJoyjJ by DariuszJ (@DariuszJ) on CodePen

×
×
  • Create New...