English 中文(简体)
如何调整 Jquery Mobile 中的所有元素的大小 以便安装在一个框架之内?
原标题:How to resize all elements in Jquery Mobile for fitting inside an iframe?

我正在与 jQuery Mobile 一起撰写一个应用程序, 它将在浏览器中作为本地移动应用程序的 preview

我打算把网络应用程序放在一个像小智能手机模拟一样的框架里。 文本的清晰度是 not 重要, 只有颜色、 图像和总体外观和感觉。

问题在于我们网站上的预览区域小( hile="330"宽度="220" ), 并且所有内容似乎都太挤(文字、按钮等有正常大小,但与一框架尺寸相比显得大)。

我试图在移动应用程序的正文中应用 font- size: 50%; width: 220px; 高度: 330px; 。 另外,元视图没有帮助 。

我的框架是这样的:

<iframe id="webapp" frameborder="0" height="330" width="220"
  src="http://jquerymobile.com/demos/1.1.0/">​

我需要让 JQM 网络应用程序更小, 或“分离出来”, 但找不到一个好的解决方案。

最佳回答

经过一些固执的研究后,我找到了一种优雅的方法 将网络应用程序缩小到 Irame 内部。 通过使用 CSS3 2D 变换 :

transform:scale(0.5,0.5);
-ms-transform:scale(0.5,0.5); /* IE 9 */
-moz-transform:scale(0.5,0.5); /* Firefox */
-webkit-transform:scale(0.5,0.5); /* Safari and Chrome */
-o-transform:scale(0.5,0.5); /* Opera */

此样式将使iframe 50%更小 。

缺点是只有 IE9+ 得到支持, 但这是可以的,因为我们都讨厌 IE。 对吗?

问题回答

您是否看过身体 { 宽度: 220px; 高度: 330px;} 和元视图标签? 您实际上应该把它做成 320x480, 因为大多数屏幕都有这个分辨率 。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签