>[info] 相关文章
* [HTML元素的height、offsetHeight、clientHeight、scrollTop等梳理](https://segmentfault.com/a/1190000037426695);
* [Javascript零碎之各种宽高属性及应用](https://segmentfault.com/a/1190000019608199) ;
* [JS获取屏幕、浏览器、页面的宽度和高度](https://segmentfault.com/a/1190000010443608);
* [# 两张图详解解元素位置宽度的属性(offsetHeight/ClientHeight/ScrollHeight/getBoundingClientRect)](https://cloud.tencent.com/developer/article/1499096)
>[info] 页面文档滚动条高度
```
const sTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
```
或者
```
const sTop = document.scrollingElement.scrollTop;
```
**说明:**
* html文档在有DOCTYPE申明的时候document.body.scrollTop = 0;
没有DOCTYPE申明的时候,document.documentElement.scrollTop = 0