繁体   English   中英

如何从父窗口顶部的iframe内部打开颜色框

[英]How to open colorbox from inside a iframe on top of parent window

我有一个带有iframe的页面。 iframe中的链接应打开颜色框。 工作正常。

但它会在iframe中打开颜色框。 是否可以在父窗口上打开iframe。

感谢您的帮助。

     $(function() {
          $('#ajax').colorbox({iframe: true });
     });

您应该可以在顶部框架中触发它

top.$.fn.colorbox({ params });

尽管您需要用勺子输入要显示的数据。

有同样的问题。 通过在父页面中放置一个函数来解决该问题,如下所示:

<script>    
$(document).ready(function(){
function call_colorBox(params) {
        $.colorbox(params);
    }
})
</script>

然后使用以下命令在iframe中调用colorbox函数:

<script>
top.parent.call_colorBox({ width: "80%", height: "80%", iframe: true, href:"http://www.google.com" });
</script>

上面的代码对我不起作用..

top.parent.$.colorbox({ 
    iframe: true, 
    width: "75%", 
    height: "75%",
    href: "frmTATABomPartsUnique.aspx?Parts=Common",
    title: "UNIQUE PARTS", 
    onComplete: function () {
        $("#cboxClose").attr("title", "Close"); 
    } 
});

此代码有效...

暂无
暂无

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

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