Jump to content
Search Community

scrollTrigger outView

ngc7293 test
Moderator Tag

Recommended Posts

23 minutes ago, GreenSock said:

I didn't quite understand your question. If you want to trigger a function when an element leaves the viewport, yes, that's easy:


ScrollTrigger.create({
  trigger: ".element",
  onLeave: yourFunction
});

Does that answer your question? 

Sorry my english is poor.

I mean, when I set {start:'top 50%'}, when "onLeave" is triggered, "trigger" is in the viewport.

I hope that no matter what value is set for "start, end", "trigger" can trigger an event when leaving the viewport. I use this event to reset "trigger"

Link to comment
Share on other sites

I wish I understood your question better. Please don't post in a foreign language (I translated it for you using Google Translate).

 

It seems to work exactly as I would expect: 

See the Pen a07cf64b24db08dab8ecec64f59312ee?editors=0011 by GreenSock (@GreenSock) on CodePen

 

When the trigger element leaves the viewport, the onLeave function is triggered. Am I missing something? 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, GreenSock said:

I wish I understood your question better. Please don't post in a foreign language (I translated it for you using Google Translate).

 

It seems to work exactly as I would expect: 

 

 

 

When the trigger element leaves the viewport, the onLeave function is triggered. Am I missing something? 


Sorry, it seems that it is difficult for me to describe my problem clearly, thanks for your reply

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...