JS 获取滚动条到底部得距离

$(window).scroll(function() {
// 变量 scrollHeight 是滚动条的总高度
let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight

// 变量 windowHeight 是可视区的高度
let windowHeight = document.documentElement.clientHeight || document.body.clientHeight

// 变量scrollTop为当前页面的滚动条纵坐标位置
let scrollTop = document.documentElement.scrollTop || document.body.scrollTop
// 滚动条到底部得距离 = 滚动条的总高度 - 可视区的高度 - 当前页面的滚动条纵坐标位置
var scrollBottom = scrollHeight

JS 获取滚动条到底部得距离最先出现在Python成神之路

版权声明:
作者:lichengxin
链接:https://www.techfm.club/p/20743.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>