1 Star 0 Fork 0

yzishan / webs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test_scroll.html 696 Bytes
一键复制 编辑 原始数据 按行查看 历史
yangzishan 提交于 2024-01-09 17:56 . 啊大大
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
#app{height: 100px; overflow-y: scroll; border: 1px solid #ff0000;}
.child{height: 50px; background: #eeeeee;}
</style>
</head>
<body>
<div id="app" onscroll="myfuc()">
<div class="child">1</div>
<div class="child">2</div>
<div class="child">3</div>
</div>
<div></div>
<script>
let app = document.getElementById('app');
console.log(app.offsetHeight,'offsetHeight');
console.log(app.clientHeight,'clientHeight');
console.log(app.scrollHeight,'scrollHeight')
function myfuc(){
console.log(app.scrollTop,'scrollTop')
}
</script>
</body>
</html>
1
https://gitee.com/yzishan/webs.git
git@gitee.com:yzishan/webs.git
yzishan
webs
webs
master

搜索帮助