Javascript 奇怪行为宽度Safari(iOS)内部/外部宽度/高度

Javascript 奇怪行为宽度Safari(iOS)内部/外部宽度/高度,javascript,mobile-safari,iphone,jqtouch,Javascript,Mobile Safari,Iphone,Jqtouch,我一直在为我们工作中的一项服务开发一个移动版本,并且一直在做一些调整,方向功能让我有点烦 因此,在试图找到更好的方法来获取方向值(轮廓或横向)时,我发现Mobile Safari返回了innerWidth/innerHeight/outerWidth/outerHeight的一些奇怪值 我已经用iPhone4和iOS 4.3做了这些测试 我的测试结果: No keyboard | window.innerWidth window.innerHeight window.oute

我一直在为我们工作中的一项服务开发一个移动版本,并且一直在做一些调整,方向功能让我有点烦

因此,在试图找到更好的方法来获取方向值(轮廓或横向)时,我发现Mobile Safari返回了innerWidth/innerHeight/outerWidth/outerHeight的一些奇怪值

我已经用iPhone4和iOS 4.3做了这些测试

我的测试结果:

No keyboard    |  window.innerWidth    window.innerHeight    window.outerWidth    window.outerHeight
---------------------------------------------------------------------------------------------------
Pro --> Lan    |                480                   268                  482                   420
Lan <-- Pro    |                321                   418                  321                   419
Pro <-- Lan    |                480                   268                  482                   420
Lan -->--> Lan |                480                   268                  482                   420
Lan <-- Pro    |                321                   418                  321                   419

With keyboard  |  window.innerWidth    window.innerHeight    window.outerWidth    window.outerHeight
---------------------------------------------------------------------------------------------------
Pro --> Lan    |                321                   418                  321                   419
Lan <-- Pro    |                481                   269                  481                   419
Pro <-- Lan    |                321                   418                  321                   419
Lan -->--> Lan |                481                   269                  481                   419
Lan <-- Pro    |                481                   269                  481                   419
在网页的某个位置添加


我所做的是按照测试结果进行旋转。复制textarea的内容,并通过电子邮件发送给self。无论是否使用键盘,键盘都会显示是否点击文本区域;)

我意识到这有点过时了,但很抱歉,我看不到你的问题。你的发现虽然看起来很奇怪,但却很有道理。当键盘显示时,它会占用宝贵的屏幕空间,从而导致窗口大小变小(同时,尽量不要挑剔,但方向称为纵向和横向,而不是纵断面和横向)。如果这不是一个问题,那么我恐怕你在错误的网站上发布了这个,这是一个问答网站。
$(document).ready(function(){
    $('body').bind('turn', function(event, info){ var dims = $('#debug').val(); dims = dims + getDimensions(); $('#debug').val(dims); });
});

function getDimensions() {
return "screen.width = " + screen.width
     + "\nscreen.height = " + screen.height
     + "\nscreen.availWidth = " + screen.availWidth
     + "\nscreen.availHeight = " + screen.availHeight
     + "\nwindow.innerWidth = " + window.innerWidth
     + "\nwindow.innerHeight = " + window.innerHeight
     + "\nwindow.outerWidth = " + window.outerWidth
     + "\nwindow.outerHeight = " + window.outerHeight
     + "\n \n ";
}