设置页面加载时滚动条自动滚到底的方法:

jQuery:


复制代码 代码如下:


 $(function(){
   var h = $(document).height()-$(window).height();
   $(document).scrollTop(h);
 });



JavaScript:


复制代码 代码如下:


 window.onload = function(){
   var h = document.documentElement.scrollHeight || document.body.scrollHeight;
   window.scrollTo(h,h);
 }

<button onclick="text1.scrollTop=text1.scrollHeight">滚动</button><br>

cache the xmlhttprequest instance, if you want to use setinterval or settimeout. or, there might be a memory leap.

  

相关文章:

  • 2022-12-23
  • 2021-07-08
  • 2021-12-03
  • 2021-11-02
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-27
相关资源
相似解决方案