Anonymous 发表于 2022-7-6 14:51:36

js控制当前页面自动滚动到底部

document.documentElement.clientHeight; 获取高度,通过scroll滚动到指定位置,代码:<script>
function rollBottom(){
    var t = document.documentElement.clientHeight;
    window.scroll({ top: t, left: 0, behavior: 'smooth' });
}
rollBottom();
</script>文章来源 https://www.yj521.com/article/194.html

页: [1]
查看完整版本: js控制当前页面自动滚动到底部