【问题标题】:Primefaces TabView iFrame HeightPrimefaces TabView iFrame 高度
【发布时间】:2014-06-25 07:16:31
【问题描述】:

我有问题。对于我的网站,我使用 Primefaces。我有 4 个站点和一个 index.xhtml。在索引上应该是一个 TabView。在每个选项卡中,我都有一个 iFrame,以包含 4 个站点。

<h:body>
<h:form id="jmsstatus">
    <p:tabView dynamic="true" style="width: 100%; height: 100%">
        <p:tab title="Site0">
            <iframe src="site0.xhtml" style="width: 100%; height: 100%"/>
        </p:tab>
        <p:tab title="Site1">
            <iframe src="site1.xhtml" style="width: 100%; height: 100%"/>
        </p:tab>
        <p:tab title="Site2">
            <iframe src="site2.xhtml" style="width: 100%; height: 100%"/>
        </p:tab>
        <p:tab title="Site3">
            <iframe src="site3.xhtml" style="width: 100%; height: 100%"/>
        </p:tab>
    </p:tabView>
</h:form>

我的问题是,每个选项卡的高度可能只有 20%,所以侧面有一个 Scrollpane,你只能看到 iframe 的一小部分。我想要,每个选项卡的高度为 100%。

我该怎么做?我找不到答案。

感谢您的帮助!

【问题讨论】:

  • 我自己找到了答案。你必须使用

标签: css iframe primefaces


【解决方案1】:

您可以使用此脚本在 iframe 中设置高度,

function resizeIframe(obj) {
   obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}

在iframe中使用此代码段调用函数,

<iframe src="" width="100%" style="border-width: 0PX;" scrolling="no" onload='javascript:resizeIframe(this);'/>

【讨论】:

    猜你喜欢
    • 2015-01-06
    • 2012-02-28
    • 2011-07-10
    • 1970-01-01
    • 2020-05-22
    • 1970-01-01
    • 1970-01-01
    • 2021-09-21
    • 1970-01-01
    相关资源
    最近更新 更多