Newbie_Jim Posted May 23, 2024 Posted May 23, 2024 See the Pen LZOMKY by GreenSock (@GreenSock) on CodePen. I modified the scrollTo example code, but the result did not work as I expected. I added offsetY to scrollTo, the first click works perfectly when the scroll position is less than the element's scroll position. However, if I repeatedly click, the offsetY continues to apply, rather than staying fixed at the desired element and then applying the offset. When the scroll position is greater than the element's position, it cannot scroll to the desired position at all. I expected it to work like box2. Currently, for box2, I am using a fixed y value. See the Pen abxxyYQ?editors=1010 by sw355498 (@sw355498) on CodePen.
Solution mvaneijgen Posted May 23, 2024 Solution Posted May 23, 2024 I've just written a guide how ScrollTo works. I think you don't want to scroll to an element in your case, but to the start of a specific ScrollTrigger. Check out the post below and also @GreenSock's comment. Hope it helps and happy tweening! 1 1
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