2012-10-24 71 views
1

如何在我的桌面上(在开发我的应用程序时)将我的视口设置为iPhone屏幕大小,而无需触摸CSS?桌面上的iPhone视口

我正在用jQueryMobile开发我的应用程序。

回答

1

视口的老式定义影响(缩放前和viewport meta标签成为与iPhone通用)是刚刚大小html元素。所以,你可以只是样式,如下所示:

html { 
    position: absolute; 
    width: 320px; 
    height: 480px; 
} 

或者,使用浏览器扩展(如“Web开发工具栏”为火狐浏览器窗口大小调整到你希望你的视口有大小

+0

谢谢,该工具正是我所需要的。 –

0

为什么不检测它是iphone还是浏览器,然后相应的样式,如;

if(navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false) 
{ 
    //ios detected 
} 
else 
{ 
    //no ios detected, add css to set the dimensions of the body 
} 

这样,CSS将只在浏览器中

+0

。是不是有一种方法来临时添加meta标签,同时开发和删除这些标签?这对我来说会更有用 –