Xenex122 Posted June 10, 2022 Share Posted June 10, 2022 Basically what I'm trying to say is that. If the scrollTrigger hits the end of the animation it supposed to console.log("end") if its on the end trigger and if going back then it will be console.log("start") if only it hits the start trigger function CallBack(e) { console.log(e) } end: () => if(hasEnd) { Callback("End") } else if (hasStart) {Callback("start")} I don't have a codepen to make sample to it but it somehow related to my recently problem that I posted here. but I think my question is here is far so I made a repost and try to simplify it. Link to comment Share on other sites More sharing options...
akapowl Posted June 10, 2022 Share Posted June 10, 2022 Hello @Xenex122 Do you mean like this? See the Pen VwQVeNr by akapowl (@akapowl) on CodePen ScrollTrigger does have a rich callback system that you can use for something like that. See the Pen qBdeVJY by GreenSock (@GreenSock) on CodePen 1 Link to comment Share on other sites More sharing options...
Xenex122 Posted June 10, 2022 Author Share Posted June 10, 2022 @akapowl I've created this new one but it doesn't work...I just based on your codes..but it doesn't make sense to me check this See the Pen BaYGaoK by myth-vince (@myth-vince) on CodePen EDIT when I scroll it up until it reach the starter it doesnt change into scrollDown?? care to explain? but the code you give is working just only the starting point. Link to comment Share on other sites More sharing options...
akapowl Posted June 10, 2022 Share Posted June 10, 2022 That is because in your scenario things never actually get past that start point when scrolling back up - you could just set the end to something like 'top -1px' e.g. and it should work. Also, be careful with your naming conventions - you store the element '.scroller' in a variable named scrollDown and then you also have an element with the class of .scrolldown in your HTML - which is very confusing. Just note, that I changed that variable name in the pen below. See the Pen zYRMBqa by akapowl (@akapowl) on CodePen 2 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