如果页的底部可见, 则返回true
, 否则为false
。
使用scrollY
、scrollHeight
和clientHeight
来确定页面底部是否可见。
const bottomVisible = () =>
document.documentElement.clientHeight + window.scrollY >= document.documentElement.scrollHeight || document.documentElement.clientHeight;
// bottomVisible() -> true
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8