繁体   English   中英

如何通过Javascript从Mobile Safari中的网页获取整个页面的高度?

[英]How do you get the entire page height from a webpage in Mobile Safari via Javascript?

我需要获取特定网页在Mobile Safari中整个文档的高度。 即使您放大了页面的特定区域,整个页面的高度也是如此。

如何通过Javascript(不是jQuery)完成此操作?

这是执行此操作的功能:

function getDocumentHeight() {
    return Math.max(
        Math.max(document.body.scrollHeight, document.documentElement.scrollHeight),
        Math.max(document.body.offsetHeight, document.documentElement.offsetHeight),
        Math.max(document.body.clientHeight, document.documentElement.clientHeight)
    );
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM