Why does scrollIntoView() not working properly?

Viewed 82

I have this code:

if (window.location.hash) {
    var comment_id = window.location.hash.substring(1);
    $("li.timeline-comment[name='" + comment_id + "']")[0].scrollIntoView();
  }

and is working fine for the first time when you access the link, but if you move to another view and than refresh/hard-refresh, first is scrolling to the right view, but after the page si fully loaded, is going to the view that was left before refreshing.

0 Answers
Related