请教各给前辈,跪谢
<!DOCTYPE html>
<html>
<head>
<title>title</title>
<style>
div {
overflow-y: auto;
height: 100px;
width: 400px;
border: 1px dotted red;
}
li {
list-style: none;
width: 200px;
height: 100px;
border: 1px solid black;
}
</style>
</head>
<body>
<div id="box">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
<script type="text/javascript">
var oBox = document.getElementById("box")
oBox.onmousewheel=function(e){
console.log(oBox.children[0].scrollTop)
}
</script>
</body>
</html>
我在oBox上加mousewheel事件,取出来的scrollTop一直都为0 这是为啥呢
皈依舞
相关分类