[英]Get device height in cordova
I am trying to find device's height in Cordova? 我想在Cordova找到设备的高度?
pChart.chartHeight = 100;
What can I write instead of 100
? 我能写什么而不是100
? 100
should be the device's height. 100
应该是设备的高度。
From window.screen
you can obtain its width and height properties, but you should also add the pixel densities since it may change on orientation or among different devices. 从window.screen
您可以获得其宽度和高度属性,但您还应该添加像素密度,因为它可能会在方向上或在不同设备之间发生变化。 Try this: 尝试这个:
var physicalScreenHeight = window.screen.height * window.devicePixelRatio;
productionChart.chartHeight = physicalScreenHeight;
And have a look here in case you have more doubts. 如果您有更多疑问,请查看此处 。
Try this. 试试这个。
var w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
alert(w +" - "+h);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.