[英]how to get device screen size in javascript which should be same for both mode landscape and portrait
I am trying to get width and height of device screen size not browser size not resolution and it should be same for both mode landscape and portrait mode. 我正在尝试获取设备屏幕尺寸而不是浏览器尺寸而不是分辨率的宽度和高度,并且对于横向和纵向模式都应该相同。 it there any possible way to get it in javascript. 它有任何可能的方式来获取它在javascript中。
A non-jQuery way to get the available screen dimension. 一种获取可用屏幕尺寸的非jQuery方法。 Use window.screen.availWidth/Height
. 使用window.screen.availWidth/Height
。
alert(window.screen.availWidth);
alert(window.screen.availHeight);
http://www.quirksmode.org/dom/w3c_cssom.html#t10 : http://www.quirksmode.org/dom/w3c_cssom.html#t10 :
availWidth and availHeight - The available width and height on the screen (excluding OS taskbars & such).
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.