alexfoxy / lax.js

Simple & lightweight (<4kb gzipped) vanilla JavaScript library to create smooth & beautiful animations when you scroll.
MIT License
10.41k stars 491 forks source link

How to perform animation only once and until end position reached? #172

Open 0x7357 opened 2 years ago

0x7357 commented 2 years ago

Is there any way to say "Hey, if you've reached your final position, please stay in that position"?

Something like a callback "onAnimationEnd(removeElement(self))"?

I'd love to get an answer.

Thanks

alexfoxy commented 2 years ago

Do you have an example? The final position depends on your configuration.

0x7357 commented 2 years ago

You scroll down and the elements animate. For example, they fly from the left to their final position. How can I disable the animation once the element has reached its final position for the first time? Actually, I want to disable the animations on elements that I have already scrolled over, so that now when I scroll up, they are immediately at their final position.

gvigroux commented 1 year ago

I would like to achieve the same