Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Jncocontrol

ScrollTrigger adding "pin-spacer" on other pages without scrollTrigger imported

Recommended Posts

Hi, i'm making a project (I don't even know what i'm doing to be honest....) but as I switch between routes my index has gsap and ScrollTrigger on it and another route doesn't have that. as I move from the index to fashion I notice it applies the pin-spacer on my page.

I tried to do a little trickery by just giving the pin-spacer a display of none. but that break the entire thing.

Anyhow, I've attached my project. Just 'npm i' and go to fashion page, back to index, and back to fashion.

https://mega.nz/file/5YYEibiJ#athvQYNm9NTqMtXuH3rxZl_2ASfk_o23l4n5iE533Gs

Link to comment
Share on other sites

51 minutes ago, Jncocontrol said:

but as I switch between routes my index has gsap and ScrollTrigger on it and another route doesn't have that.

 

Sounds like you're not killing you're ScrollTriggers when changing routes.

Link to comment
Share on other sites

34 minutes ago, OSUblake said:

 

Sounds like you're not killing you're ScrollTriggers when changing routes.

 

I tried doing that, but didn't work. Perhaps I did it wrong. How do i achieve it?

Link to comment
Share on other sites

How did you try it? I would assume that you need to kill them in the onDestroy lifecycle.

 

Link to comment
Share on other sites

1 hour ago, OSUblake said:

How did you try it? I would assume that you need to kill them in the onDestroy lifecycle.

 

I got the code from here.
 

 

Link to comment
Share on other sites

Look at onDestroy. You need to kill the triggers before the route changes.

 

  • Like 1
Link to comment
Share on other sites

7 hours ago, OSUblake said:

Look at onDestroy. You need to kill the triggers before the route changes.

 

That did the trick. I don't know what I was thinking, should've been obvious. Much Appreciated.

  • Like 1
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.
×