Jump to content
Search Community

Gsap scroll trigger auto-scrolls when I navigate back.

ogis test
Moderator Tag

Recommended Posts

I have a react application with scrolltrigger animation for horizontal scrolling. 

Every section is a link to a page. On first load, this works well, but when I open the page linked to each section and navigate back, the horizontal scroll automatically scrolls to the last one. Also, I have an extra white space at the bottom of each page. Anyone know why this might be happening?

Link here: Site

 

 

    tl.to(sections, {
      xPercent: -100 * (sections.length -1),
      ease: "none",
      scrollTrigger: {
          trigger: ".horizontal_wrapper",
          pin: true,
          start: 'top',
          snap: 1 / (sections.length - 1),      
          // markers: true,
          scrub: 1,
      end: () => "+=" + (document.querySelector(".horizontal_container").offsetWidth / 4),
      }
  })
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...