文章详情页
javascript - 关于document.documentElement.scrollTop和documen.body.scrollTop的問題
浏览:273日期:2023-04-04 09:56:46
问题描述
求大大幫忙。。刚刚遇到一个问题,就是关于document.documentElement.scrollTop 和documen.body.scrollTop适应的问题,我看网上说document.documentElement.scrollTop是在标准模式下使用的,。。但是为什么我自己测试在html5标准模式下document.documentElement.scrollTop值一直是0,而documen.body.scrollTop反而是有值的?
问题解答
回答1:不同浏览器处理的结果不一样戳我
回答2:浏览器兼容问题.建议写成 let top = document.documentElement.scrollTop || document.body.scrollTop
标签:
JavaScript
相关文章:
1. dockerfile - [docker build image失败- npm install]2. docker gitlab 如何git clone?3. boot2docker无法启动4. docker网络端口映射,没有方便点的操作方法么?5. docker-compose中volumes的问题6. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””7. docker api 开发的端口怎么获取?8. dockerfile - 我用docker build的时候出现下边问题 麻烦帮我看一下9. docker images显示的镜像过多,狗眼被亮瞎了,怎么办?10. docker不显示端口映射呢?
排行榜
![dockerfile - [docker build image失败- npm install]](http://www.haobala.com/attached/image/news/202311/1028105a80.png)
网公网安备