Automatically scroll to bottom as the page loads

前端 未结 4 530
猫巷女王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条回答
  •  Happy的楠姐
    2020-12-21 06:19

    Every 5 seconds, it will scroll the page to the bottom of the page.

    function autoScrolling() {
       window.scrollTo(0,document.body.scrollHeight);
    }
    
    setInterval(autoScrolling, 5000); 
    // adjust the time limit based on the frequency log gets updated
      
       
          
       
      

提交回复
热议问题