简体   繁体   English

如何在javascript中获取设备屏幕尺寸,模式横向和纵向都应相同

[英]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.

相关问题 检测屏幕何时处于纵向或横向模式以及跨设备的屏幕边缘 - Detecting when screen is in portrait or landscape mode and the edges of a screen across device 如何在javascript / jquery中找出ipad是否处于横向/纵向模式? - How to find out if ipad is in landscape/portrait mode in javascript/jquery? 如何基于处于横向与纵向模式下的移动设备来更改元素的高度? - How can I change an element's height based on a mobile device being in landscape vs. portrait mode? 我可以使用jquery确定设备是处于纵向还是横向模式? - Can I determine if a device is in portrait or landscape mode using jquery? 如何在Java Web应用程序中获取实际的移动设备屏幕尺寸? - How to get actual mobile device screen size in web applications, javascript? 在设备旋转时使用javascript或CSS从纵向/横向重定向 - Redirect using javascript or CSS on device rotation from portrait/landscape 使用PHP检索风景/肖像模式 - Retrieve landscape/portrait mode with PHP 如何在纵向和横向模式下在本机反应中以固定宽度居中 - How to center a parent with fixed width in react native in portrait and landscape mode 当我们的设备从纵向模式定向到横向模式时,是否完全加载了地图时是否触发了Map事件? - Is there any Map event fired when map is loaded completely when we device is oriented from portrait to landscape mode? 纵向模式在 Unity Webgl 中的浏览器上显示黑屏,横向打开正常 - Portrait mode shows black screen on a browser in Unity Webgl, landscape opens fine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM