2015-05-08 34 views
0

我正在开发在iphone上查看的网页。要获得iPhone 上的确切分辨率,我测试了以下几行代码。什么是iphone屏幕的实际分辨率

pageWidth = $j(document).innerWidth(); 
    alert(pageWidth); 
根据 http://www.iphoneresolution.com/我的iPhone 5

具有640像素宽度,

但是,当我执行我的代码,我得到以下警告。

这个形象是从模拟器,我得到同样的在我的iPhone iphone screen pixels are less then what it is described

谁能告诉我这是什么如此?

感谢

回答

1

screen.width会给你的设备屏幕的宽度。

你还需要注意的是,设备的分辨率并不决议所对应的网页显示。

http://www.mydevice.io/devices/

+0

我应该遵循HTML开发屏幕宽度或innerwidth?因为内容(div,li,img等)通过x和y位置绝对定位。 – MFarooqi

+0

由于HTML使用'top','bottom','left'和'right'进行定位,所以我会说'screen.width'和'screen.height'只会用于'bottom'和'right '定位。 X和Y分别指的是'left'和'top',因此在这种情况下我看不到使用'screen.width'或'screen.height'的好处。例如,在使用'right'和'bottom'的情况下,我可以看到'screen.width'和'screen.height'用于确保元素不会离开屏幕。 –

+0

谢谢.. mydevices.io/devices/真的是一个有用的资源。 – MFarooqi