代码实现:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div class="d" style="height: 1000px;"></div>
<script>
window.onscroll = function(){
if(document.documentElement.scrollTop + document.documentElement.clientHeight == document.documentElement.scrollHeight){
console.log("到底部了")
}
}
</script>
</body>
</html>
关键代码:
window.onscroll = function(){
if(document.documentElement.scrollTop + document.documentElement.clientHeight == document.documentElement.scrollHeight){
console.log("到底部了")
}
}