TomS0 Posted June 27, 2022 Share Posted June 27, 2022 Hey everyone, onEnter only seems to fire when scrolling down, not strictly when it has entered the viewport (based on the start, end params) as you would expect. I have used onUpdate to get around this but for performance reasons I would like to avoid it. Do you have any ideas what I'm doing wrong here? Thanks, Tom See the Pen ZExzMXz by TheTomS (@TheTomS) on CodePen Link to comment Share on other sites More sharing options...
SteveS Posted June 27, 2022 Share Posted June 27, 2022 You need to use onEnterBack: () => {} if you want to do something when you enter backwards. You might also be able to use onToggle but I haven't tried that before. 1 Link to comment Share on other sites More sharing options...
GreenSock Posted June 27, 2022 Share Posted June 27, 2022 Perhaps you're looking for this?: See the Pen LYdPKew?editors=0010 by GreenSock (@GreenSock) on CodePen Steve is correct - onEnter is for when it enters as scroll increases. onEnterBack is for the opposite way. You can use onToggle and isActive to simplify things too, like in the demo: onToggle: self => self.trigger.innerText = self.isActive ? "In View" : "Not In View" Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now