简体   繁体   English

当浏览器不是 100%(大小)时如何获取 max-innerHeight

[英]How to get the max-innerHeight when browser is not 100% (size)

Suppose window.innerHeight = 978px when the browser is 100% (not full screen).假设浏览器为 100%(非全屏)时window.innerHeight = 978px

However, when resizing the browser, window.innerHeight value will decrease.但是,在调整浏览器大小时, window.innerHeight值会减小。

So how to get the height = 978px when when the browser is not 100%?那么当浏览器不是 100% 时,如何获得height = 978px呢? (I want to get this to calculate something in js script) (我想让这个在 js 脚本中计算一些东西)

Update更新

I have an idea how to get this, the script should be我有一个想法如何得到这个,脚本应该是

window.screen.availHeight - window.outerHeight + window.innerHeight

But, for Safari, the script should be但是,对于 Safari,脚本应该是

window.screen.availHeight - window.outerHeight + window.innerHeight - 3

You maybe need to look for:您可能需要寻找:

screen.height

The issue is I'm not sure you can use get the height of the start-bar (assuming it's windows and on the bottom).问题是我不确定你可以使用获取起始栏的高度(假设它是 windows 并且在底部)。 Otherwise this will probably be a good starting point.否则,这可能是一个很好的起点。

https://www.w3schools.com/js/js_window_screen.asp https://www.w3schools.com/js/js_window_screen.asp

Try this:尝试这个:

document.documentElement.clientHeight

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

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