chrome浏览器滚动到底部无法加载,实际上没到底部,差一点点下不去,怎么解决?
<!DOCTYPE>
<html>
<head>
<meta charset="UTF-8">
<title>网页滚动到底部或者顶部加载</title>
<style type="text/css" rel="stylesheet">
*{margin:0;padding:0;}
.scrolldiv{
width: 800px;
height: 600px;
margin:300px auto 100px auto;
background-color: #FF0000;
}
</style>
</head><body>
<div class="scrolldiv"></div>
<!--js写法-->
<script type="text/javascript">
function scrollBottomOrTop(){
var clients=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
//console.log(clients);
var scrollTops=document.body.scrollTop;
//console.log(scrollTops);
var wholeHeight=document.body.scrollHeight||document.documentElement.scrollHeight;
//console.log(wholeHeight);
if(clients+scrollTops>=wholeHeight)
{
alert("bottom")
}
if(scrollTops==0){
alert("top")
}
}
window.onscroll= scrollBottomOrTop;
</script></body>
</html>