简体   繁体   English

使用iframe-resizer时将页面填充到调整后的iFrame顶部

[英]Padding to top of resized iFrame when using iframe-resizer

So I am using the awesome iframe-resizer library in order to resize an iFrame and keep it in focus. 因此,我使用了很棒的iframe-resizer库来调整iFrame的大小并使其聚焦。

The trouble is (for the life of me) I can't figure out how to make the iFrame, when resized, add some additional padding to the top. 问题是(为了我的生命)我无法弄清楚如何调整iFrame的大小,在调整其大小时,请在顶部添加一些其他填充。

What is happening, is that the iFrameResizes at a certain point and the window scrolls up, but the iFrame is placed underneath the fixed menu (see below). 发生的情况是,iFrameResizes在某个点上并且窗口向上滚动,但是iFrame放置在固定菜单的下方(请参见下文)。 I think it is due to the fact that iFrameResize is using the full window size and does not account for the fixed menu. 我认为这是由于iFrameResize使用的是整个窗口大小,而不考虑固定菜单的事实。 I'm not sure how to repair that? 我不确定该如何修复?

Here's the html basically 这基本上是HTML

<div style="position:fixed;z-index:99; width:100%">
 <nav class="top-bar"><section>
  <ul><li><a href="http://somelink">top link></li><li><a href="http://somelink">top link></li></ul>
 </section></nav>
</div>
<div style="float:left;width:50%;">left panel with text</div>
<div style="float:right;width:50%;">
  <div>
   <iframe style="border:none;overflow:hidden;" src="http://someurl" width="80%" height="100%" scrolling="no" id="iFrameResizer0"></iframe>
   <script>iFrameResize({log: true, 
        checkOrigin: false,
        enablePublicMethods: true,
    })
   </script>
  </div>
</div>

If anyone could guide me on additional parameters to change and/or add to add this additional padding that would be awesome. 如果有人可以指导我更改和/或添加其他参数以添加此附加填充,那将是非常棒的。

For the record, I tried to add an additional margin-top and padding-top but that did not work to resolve the issue. 作为记录,我尝试添加额外的margin-top和padding-top,但这无法解决问题。 Also, the two columns should be the same height when the page is first loaded so this isn't an ideal solution. 另外,首次加载页面时,两列的高度应相同,因此这不是理想的解决方案。

看一下在需要时使用resizeCallback添加填充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM