Window:scrollMaxX 属性
非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!
Window.scrollMaxX
只读属性返回文档可以水平滚动的最大像素数。
值
一个数字。
示例
js
// 滚动到页面右边缘
let maxX = window.scrollMaxX;
window.scrollTo(maxX, 0);
备注
不要使用此属性来获取文档的总宽度,因为它不等于 window.innerWidth + window.scrollMaxX。这是因为 window.innerWidth
包括任何可见垂直滚动条的宽度,因此结果会比文档的总宽度多出任何可见垂直滚动条的宽度。请使用 document.body.scrollWidth
代替。参见 window.scrollMaxY
。
规范
不属于任何规范。
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scrollMaxX |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Non-standard. Check cross-browser support before using.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.