console
let e = document.getElementById('content')
e.addEventListener('mousewheel', function (e) {
let element = document.getElementById('content')
let info = `offsetHeight: ${element.offsetHeight}, scrollTop: ${element.scrollTop}, scrollHeight: ${element.scrollHeight}`
document.getElementById('info').innerHTML = info
if (_wheelEnd(element)) {
document.getElementById('info').innerHTML += '到底啦!'
}
}, false)
function _wheelEnd (e) {
return (e.scrollTop + e.offsetHeight) >= e.scrollHeight
}
<ul id="content">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<h3>
结果:
</h3>
<div id="info">
</div>
ul {
margin: 0 auto;
padding: 0;
width: 200px;
height: 200px;
border-radius: 50%;
border: 1px solid;
overflow-y: auto;
}
li {
list-style: none;
width: 100px;
height: 200px;
background-color: #000;
}
#info {
margin: 0 auto;
width: 400px;
height: 100px;
margin-top: 20px;
}