弹窗问题,?

<!DOCTYPE HTML>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<div id="showId"></div>
<style type="text/css">
#showId{width:500px; height:400px; margin:1000px auto 100px auto; background:#ff0000;}
</style>
<script type="text/javascript">
function scrollBottomOrTop(){
var clients=document.body.clientHeight||document.documentElement.clientHeight||window.innerHeight;
var scrollTop=document.body.scrollTop;
var wholeHeight=document.body.scrollHeight; if(clients+scrollTop>=wholeHeight)
{ alert("我已经到底部了!") }
if(scrollTop==0){ alert("我滑到顶端了!") } } window.onscroll=scrollBottomOrTop;
</script>
</body>
</html>
为什么滑到底部是窗口不弹出来?

什么鬼_呀你
浏览 1146回答 1
1回答

牛奶老哥哥

你滑到底部时把 clients+scrollTop console 出来看看会不会 >= wholeHeight
打开App,查看更多内容
随时随地看视频慕课网APP