Html iPad 上的 iframe 大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6139564/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
iframe size on iPad
提问by testndtv
I have an HTML file as follows;
我有一个 HTML 文件,如下所示;
<table height="100%" cellspacing="0" cellpadding="0" border="0" width="646" class="data border">
<tbody>
<tr>
<td valign="top" class="noPad">
<iframe height="100%" frameborder="0" width="100%" scrolling="no" name="studentFrame" src="delete2.html"></iframe>
</td>
</tr>
</tbody>
</table>
The iframe page delete2.html has a table of width = 846 i.e. it is more than the containing td width
iframe 页面 delete2.html 有一个宽度 = 846 的表格,即它大于包含的 td 宽度
So this only shows around 646 width of the iframe content on page load and rest scrolls..
因此,这仅在页面加载和静止滚动时显示 iframe 内容的大约 646 宽度。
But on the iPad, the complete 846px of iframe content gets displayed and it kind of appears to flow outside the table width..so it appears broken..
但是在 iPad 上,iframe 内容的完整 846 像素被显示出来,并且它似乎在表格宽度之外流动......所以它看起来很破碎......
How can I fix this issue?
我该如何解决这个问题?
回答by CobaltBlueDW
Starting in version 4.2.1 of Safari iOS, and still going as of 4.3.3, the entire content of an iFrame is forcibly shown. If your iFrame's content is in the same security sandbox as the outer page, you can surround the iframe with a div tag and use that to do the scrolling.
从 Safari iOS 的 4.2.1 版本开始,直到 4.3.3,iFrame 的全部内容都被强制显示。如果您的 iFrame 的内容与外部页面在同一个安全沙箱中,您可以用 div 标签包围 iframe 并使用它来进行滚动。
This fiddle doesn't work because of security sandbox restrictions, but it should work find for you if both pages have the same domain: iPad iFrame single finger scrolling
由于安全沙箱限制,此小提琴不起作用,但如果两个页面具有相同的域,它应该可以为您找到:iPad iFrame single finger scrolling
回答by Prodigious
Just put scrolling="no"
in the iframe-tag. Notice that you still need to do something about the scrolling, as @CobaltBlue said.
只需放入scrolling="no"
iframe-tag。请注意,正如@CobaltBlue 所说,您仍然需要对滚动做一些事情。