Automatically scroll to bottom as the page loads

前端 未结 4 536
猫巷女王i
猫巷女王i 2020-12-21 06:08

I have a php script that shows a log of its actions as the script proceeds. The log is getting quite long, up to the point where it will echo its information past the bottom

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 06:17

    I think what you're looking for is this: http://www.w3schools.com/jsref/met_win_scrollto.asp

    And then, used with conjunction with this: http://www.w3schools.com/jsref/prop_element_scrollheight.asp

    You can make something like:

        function scrollToBottom{
             window.scrollTo(0, document.body.scrollHeight);
        }
    

提交回复
热议问题