雅安论坛

标题: js控制当前页面自动滚动到底部 [打印本页]

作者: 匿名    时间: 2022-7-6 14:51
标题: js控制当前页面自动滚动到底部

document.documentElement.clientHeight; 获取高度,通过scroll滚动到指定位置,代码:

  1. <script>
  2.   function rollBottom(){
  3.     var t = document.documentElement.clientHeight;
  4.     window.scroll({ top: t, left: 0, behavior: 'smooth' });
  5.   }
  6.   rollBottom();
  7. </script>
复制代码
文章来源 https://www.yj521.com/article/194.html







欢迎光临 雅安论坛 (https://www.yaanbbs.net/) Powered by Discuz! X3.4