阅读(4417) 赞(4)

window属性:scrollMaxY

2018-07-06 10:58:52 更新

scrollMaxY属性

注意:scrollMaxY属性是非标准的,不要在面向Web的生产站点上使用它:它不适用于每个用户。实现之间可能存在很大的不兼容性,并且行为可能在将来发生变化。

scrollMaxY属性返回文档可以垂直滚动的最大像素数。

scrollMaxY属性语法

ypix = window.scrollMaxY
  • ypix是像素数。

scrollMaxY属性示例

// Scroll to the bottom of the page
var maxY = window.scrollMaxY;

window.scrollTo(0,maxY);

笔记

不要使用此属性来获取总文档的高度,这不等于window.innerHeight+ window.scrollMaxY,因为window.innerHeight包括任何可见水平滚动条的宽度,因此结果将超过总文档高度乘以任何可见水平滚动条的宽度,而是使用document.body.scrollHeight。

规范

这不是任何规范的一部分。

浏览器兼容性

电脑端 移动端
Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
Android webview Chrome for Android
Edge Mobile Firefox for Android
Opera for Android
iOS Safari
基本支持
(非标准)
不支持 ? 支持 ? ? ? 不支持 不支持 ? 支持 ? ?