metafizzy / isotope

:revolving_hearts: Filter & sort magical layouts
https://isotope.metafizzy.co
11.03k stars 1.42k forks source link

How to scroll to a specific element during layout-animation? #1652

Closed sbormann closed 1 year ago

sbormann commented 1 year ago

I would like to scroll to the position of a specific element. Is there a way to find out the goal-coordinates before the layout animation has completed? Many thanks and greetings!

thesublimeobject commented 1 year ago

@sbormann — You won't be able to get the coordinates for item locations until the calculations have completed. The layout can be triggered without an animation, but it will still need to be recalculated for the new layout (whatever that may be). So you would have to wait until after the layout has completed before you could get the position of the desired item you would like to scroll to.