Jump to content
Search Community

Observer.create / ScrollTrigger.observe / get / kill

Page Tailoring test
Moderator Tag

Recommended Posts

I just developing web page with ScrollTrigger, and want to add Observe. When I use ScrollTrigger.observe there is no way to catch it and kill it.

gsap.getById and ScrollTrigger.getById dosn't work. I think it would be logical to ScrollTrigger.getById would work for it. For exempel to kill it 🙈  Yust idea 🧐

 

happy tweening 

Link to comment
Share on other sites

Hello @Page Tailoring

 

As the docs say

 

Quote

ScrollTrigger.observe() is just a convenient way to access Observer.create().

 

So you should be able to get it by using Observer.getById('yourID') 

 

And thus you should be able to kill it by using Observer.getById('yourID').kill()

 

See the Pen NWyoroR by akapowl (@akapowl) on CodePen

 

 

 

Or alternatively just store it to a variable and kill it like this yourVariable.kill() 

 

See the Pen ExQrgxd by akapowl (@akapowl) on CodePen

 

 

 

Scroll up/down as you like in those demos and then click anywhere to kill it. Does that work for you?

 

  • Like 3
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...