I have a function:

function scrollDown() { var scrollHeight = document.documentElement.scrollHeight; var clientHeight = document.documentElement.clientHeight; scrollHeight = Math.max(scrollHeight, clientHeight); window.scrollTo(0, scrollHeight - document.documentElement.clientHeight) } 

How to use it, so that when you open the page, it scrolls down?

<body onload="scrollDown()"> - does not work.

  • Required via javascript or via jquery? - Svyatoslav
  • In general, honestly, I want to do without Jquery - sinedsem

1 answer 1

 <script> window.onload = function() { document.getElementById('bottom').scrollIntoView(true); } </script> <div style="height: 5000px;">Top</div> <div id="bottom">Bottom</div> 
  • Senk Yu, it was enough for me to line window.onload =) - sinedsem