使iframe内容在iframe范围外溢出 [英] Make iframes content overflow outside iframe extents

查看:1084
本文介绍了使iframe内容在iframe范围外溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 iframe 的网页。在 iframe中是嵌入的Youtube视频。当我播放此视频时,我会将其放大(增大)。随着视频的增长,并不是所有视频都可见,因为iframe不够宽。

是否有可能使iframe'溢出其内容',即使视频在iframe宽度之外可见(请参阅下面的屏幕截图以获取有关我的内容的清晰示例我试图实现)。



这是网页目前的样子:

这是我想让视频看起来完全长大的原因:
< img src =https://i.stack.imgur.com/xWcbO.jpgalt =在这里输入图片描述>



注意我只是不能让iframe更宽。我试过给iframe(及其所有子元素)CSS overflow:visible ,但它不会改变任何内容。



这是网页排列方式的一个简单示例:

  .... head,打开html标签,等等在这里
< body>
< div id =outerContainerstyle =overflow:visible>
< div id =navBar> ...< / div>
< div id =content style =overflow:visible>
< iframe src =myHelpDocumentation.htmlstyle =overflow:visible>

<! - 此iframe /网页内部是嵌入的Youtube视频
每个视频都是iframe本身(位于div内) - >

< / iframe>
< / div>
< / div>
< / body>

您是否知道使用CSS或HTML在iframe范围之外显示视频的方式?我可以使用Javascript从iframe中删除视频(iframe),将它放置在主网页中,但是这将会是非常糟糕的网站设计,您不觉得吗?

解决方案

...
$ b

来自 iframe 的文档是完全不同的文档,浏览器安全性不会让您这样做...



编辑:您可以使用全屏使用透明背景颜色的容器并放置您的嵌入视频。



全屏代码在< a href =https://stackoverflow.com/a/17418879/1420197>这个答案。


I have a webpage that contains an iframe. Inside that iframe is an embedded Youtube video. When I play this video I make it scale up (grow) in size. As the video grows, not all the video is visible because the iframe is not wide enough.

Is it possible to make the iframe 'Overflow its content', ie make the video visible outside the iframe width (please see below screen captures for a clear example of what I am trying to achieve).

This is how the webpage currently looks:

This is how I would like to make the video look when it has fully grown:

Note I just cant make the iframe wider. I've tried giving the iframe (and all its child elements) the CSS overflow: visible but it doesn't change anything.

This is a simple example of how the webpage is arranged:

....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>

Do you know of a way using CSS or HTML to show the video outside the iframe extents? I could potentially use Javascript to remove the video(iframe) from the iframe and place it in the main webpage but this would be very bad website design dont you think?

解决方案

No, it isn't possible...

The document from iframe is a completely another document, and the browser security will not let you to do this...

Edit: you can use fullscreen property using transparent background color for container and put there your embedded video.

The fullscreen code was described in this answer.

这篇关于使iframe内容在iframe范围外溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆