【发布时间】:2013-06-29 08:15:45
【问题描述】:
我有一个包含iframe 的网页。在 iframe 里面是一个嵌入的 Youtube 视频。当我播放这个视频时,我会放大(扩大)它的大小。随着视频的增长,并非所有视频都可见,因为 iframe 不够宽。
是否可以使 iframe '溢出其内容',即使视频在 iframe 宽度之外可见(请参阅下面的屏幕截图,了解我想要实现的目标的清晰示例)。
这是网页当前的外观:
这就是我想让视频完全成长后的样子:
请注意,我只是无法使 iframe 更宽。我尝试为 iframe(及其所有子元素)提供 CSS overflow: visible,但它并没有改变任何东西。
这是一个网页排列方式的简单示例:
....head, opening html tag, etc. up here
<body>
<div id="outerContainer" style="overflow: visible">
<div id="navBar">...</div>
<div id="content style="overflow: visible">
<iframe src="myHelpDocumentation.html" style="overflow: visible">
<!-- Inside this iframe/webpage are the embedded Youtube videos.
Each video is an iframe itself (that sits inside a div). -->
</iframe>
</div>
</div>
</body>
您知道使用 CSS 或 HTML 在 iframe 范围之外显示视频的方法吗?我可以使用 Javascript 从 iframe 中删除视频(iframe)并将其放在主网页,但您不认为这将是非常糟糕的网站设计吗?
【问题讨论】:
-
使用新窗口并将视频附加到其中,然后将其最大化.. 因为如果没有另一个容器,您无法将内容溢出帧
-
@CME64 感谢您的评论。你说的新窗口,是指新的弹窗,新的文档,创建一个div并追加到父文档的末尾,究竟是什么?
-
window.open().. 参考w3schools.com/jsref/met_win_open.asp
-
@CME64 制作弹出窗口不是解决方案。像往常一样,老板想要一个优雅的解决方案。希望它看起来像 iPad 视频功能 - 增长到特定大小然后播放。
-
让我为你做一些测试和例子
标签: javascript jquery html css iframe