【问题标题】:Lightbox iframe close灯箱 iframe 关闭
【发布时间】:2013-02-11 14:06:10
【问题描述】:

我在 Lightbox iframe 中有一个按钮。如何通过单击该按钮关闭该 iframe?

我的代码如下所示:

<p:lightBox id="posetastavkeListaLightBox" 
            widgetVar="posetastavkeListaLightBoxWidget" 
            iframe="true" width="900px" height="700px">          
</p:lightBox>

【问题讨论】:

标签: javascript jsf iframe primefaces


【解决方案1】:

通过this answerClose a lightBox primefaces from iframe Button

<p:lightBox id="light" iframe="true" width="80%" height="80%" widgetVar="dlg">

iframe边:

<p:commandButton value="Close" onsuccess="parent.dlg.hide();" ajax="true" process="@none" />

【讨论】:

  • 重新加载非常昂贵,因此我会丢失一些数据。但是类似的东西会有所帮助
  • 回答的补充是我必须在 onsuccess 中添加类似这样的内容: parent.dlg.showURL({src:''});那是因为如果我在该表单中输入了一些值然后将其隐藏,如果我想再次打开该 iframe,首先我会看到之前的值。持续一两秒,然后一切正常
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-09-22
  • 1970-01-01
  • 2013-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多