简体   繁体   English

如何检测移动设备的浏览器内部宽度

[英]How to detect browser internal width for mobile devices

I want to detect mobile browser internal height for all mobile devices. 我想检测所有移动设备的移动浏览器内部高度。 If it is not possible then can we fix mobile mode like portrait or landscape any of one permanent as a fix mode for mobile site. 如果不可能,那么我们可以固定一个永久性的移动模式(例如纵向或横向)作为移动站点的固定模式。 I am using this but unable to get exact internal height. 我正在使用此功能,但无法获得确切的内部高度。

$(window).height();

Try innerWidth() to get the mobile internal width like 尝试innerWidth()获取移动内部宽度,例如

var mobileWidth=$(window).innerWidth();
var mode='POTRAIT';
if($(window).width() > $(window).height())
{
    mode='LANDSCAPE';
}
alert(mode);

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

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