Good day! It is necessary to scroll to a specific element when loading the page. I do this:

document.getElementById('elId').scrollIntoView(false) 

Chrome scrolls to the item, then scrolls back to the top of the page.
I saw that there is such a thing on vk.com on the dialogue page - the page scrolls to the end of the dialogue.

  • one
    @woland, this is not all your code. There is something else that returns the page to its original position. And so, [everything works fine] [1] [1]: jsfiddle.net/8Lswf7cc - Deonis

1 answer 1

  var elem = document.getElementById('elId'); elem.scrollTop = elem.scrollHeight; 

This is by the end of the page, but you can set the scrollTop as you need. Good luck.