jQuery - 从内部关闭iFrame Popup(从子内部关闭父级)

时间:2014-10-28 11:09:55

标签: jquery iframe popup bpopup

我在页面的弹出窗口中使用bPopup设置了iframe,并进行了以下设置:

HTML

<div id="iframePopup">
    <div class="content"></div>
</div>
<button id="popIt">SHOW</button>

的jQuery

jQuery('#popIt').click(function(){
    jQuery('#iframePopup').bPopup({
        content:'iframe',
        contentContainer:'.content',
        loadUrl:'http://www.site-url.com',
        opacity:0.4,
        iframeAttr:('scrolling="yes"')
    });
});

这很好但我需要能够关闭弹出窗口,如果我点击iframe本身的特定按钮。

bPopup docs / api状态我可以用以下命令关闭弹出窗口:

jQuery('#close-btn').click(function(){
    var bPopup = jQuery('#iframePopup').bPopup();
    bPopup.close();
});

但这仅在按钮位于HTML页面上而非iframe中时才有效。如何定位iframe中的#iframePopup

0 个答案:

没有答案
相关问题