火狐浏览器获取body滚动条位置lsft
时间: 2024-02-12 22:07:37 浏览: 31
你可以使用以下JavaScript代码来获取火狐浏览器中body滚动条的位置:
```
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
```
其中,`window.pageXOffset`用于获取滚动条在水平方向上的位置,而`document.documentElement.scrollLeft`用于获取滚动条距离文档左侧的距离。
注意,这段代码只适用于火狐浏览器。如果你需要适配其他浏览器,可以使用类似的方法来获取滚动条位置。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)