简体   繁体   English

如何获得不同缩放级别的文档高度?

[英]How to get the document height at different zoom level?

I am using ASP.NET and C#. 我正在使用ASP.NET和C#。

document.documentelement.offsetHeight 

I am using this to find the height of the page. 我正在用它来查找页面的高度。 But it is differing based on zoom level. 但是根据缩放级别而有所不同。 Now i need to get the base height(at 100% zoom) at all zoom level. 现在我需要获得所有缩放级别的基本高度(100%缩放)。 Because using this i am doing some calculation to set height of other tags. 因为使用这个,我正在做一些计算来设置其他标签的高度。

Is it possible? 可能吗?

Edit: 编辑:

I did used this to detect the zoom level 我确实用它来检测缩放级别

((screen.deviceXDPI / screen.systemXDPI) * 100).toFixed();

But it is not accurate. 但这是不准确的。 Is there any other way to detect the zoom level? 还有其他方法可以检测缩放级别吗?

document.height / $(document).height() should give you the zoom level. document.height / $(document).height()应该为您提供缩放级别。 I've tested this on chrome - requires jquery 我已经在chrome上测试过-需要jquery

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

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