Alexey Berezutsky
Alexey Berezutsky

Reputation: 33

ScrollIntoView for dynamic lists

Here is code sample

I need to scroll the element to the top of the page. But the problem is that list (which contains the element) is asynchronous. And I can not predict the height of elements on top and after the element. I was trying different approaches. And because of the fact that I can not put any code into the elements (to check if they are finishing their load process), I decided to stop on setTimeout. But it's not a good solution.
Is it possible to avoid it? I'm using react for that. But it could be a general JS question.

Upvotes: 0

Views: 132

Answers (0)

Related Questions