Jump to content
Search Community

Detect if scrolling stopped with scrolltrigger

fonveton test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Is there a way to detect scrolling stopped while using scrolltrigger. I have an element i'm rotating based on scrolling direction with self.direction but I want that element to return original rotation when scrolling stopped. Is there an event or some other way that I'm having a hard time finding?

Link to comment
Share on other sites

 

There is a 'scrollEnd' event.

 

Quote

[...]

  • "scrollEnd" - when any ScrollTrigger-related scroller stops scrolling (when roughly 200ms elapses since the last "scroll" event AND the user doesn't have a pointer/mouse pressed on the document/scrollbar)

These events get dispatched globally when any such ScrollTrigger-related event occurs (it is not tied to a particular instance).

 

 

ScrollTrigger.addEventListener("scrollEnd", () => console.log("scrolling ended!"));

 

https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.addEventListener()

 

  • Like 1
Link to comment
Share on other sites

  • Solution
53 minutes ago, fonveton said:

Is there a way to apply this to a specific scrolltrigger which is inside a gsap.timeline?

 

Judging from the descripiton in the docs, I don't think so, as it says that those are global events.

 

2 hours ago, fonveton said:

I have an element i'm rotating based on scrolling direction with self.direction but I want that element to return original rotation when scrolling stopped.

 

Based on that description of yours, maybe on of these threads below can help. If they don't, a minimal demo of your scenario would be really helpful.

 

 

 

  • 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.
×
×
  • Create New...