Jess.Park Posted November 3, 2021 Share Posted November 3, 2021 I have multiple absolute positioned h1s. I want to make h3 to follow smoothly along h1's offsetHeight on loop. But on repeat,h3 starts with a jump from top. How can I fix the jump at the start of loop? Since I'm doing something else in my project, I must use timeline within h1s.forEach. See the Pen dyzJzyd by impetusjj (@impetusjj) on CodePen Link to comment Share on other sites More sharing options...
Solution elegantseagulls Posted November 3, 2021 Solution Share Posted November 3, 2021 This is tricky because you'll have to tween the h3 back to its original position, or it doesn't have a context of where it's really starting from... With what you have going on the forEach, you are creating a new timeline for each iteration. This solution adds to a single timeline onEach, then goes back to its original position: See the Pen JjyMpRx?editors=0110 by ryan_labar (@ryan_labar) on CodePen Link to comment Share on other sites More sharing options...
Jess.Park Posted November 4, 2021 Author Share Posted November 4, 2021 Thank you so much! I’ll try this approach right away 😆 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