javascript – Transition with js to a constantly moving element

I have a cart logo on a header with sticky position and i have some cards in the website, when i click on a card a small logo flies from the clicked card to the cart logo then disappears, i’m using JS to get the absolute position of the cart logo then adding a top/left to my little small logo that i want to reach the cart.
everything is working fine until the user scroll right after clicking on the card then the logo misses the cart cause its position have moved.
how can i solve this?
if this has any value my transition duration is 2 seconds

Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here