2013-01-02 71 views
0

我使用jQuery和colorbox lightbox插件在ligthbox中打开iframe。colorbox - 关闭父iframe并打开新的iframe lightbox

的问题是:

  1. 我点击按钮,它会打开我的主要的iframe收藏
  2. 主要IFRAME里面灯箱 - 有按钮,类.flash_shareable
  3. 当你点击,它应该关闭父级(即主iframe),然后打开一个新的iframe,它链接到

它是关闭父iframe,但它不打开新的iframe。

我的代码:

$(document).ready(function(){ 
     var y = $(document.body).height(); 
     var x = $(document).width(); 
     parent.$.colorbox.resize({innerWidth:x, innerHeight:y}); 

     $('.iframe').colorbox({iframe:true}); //ligthbox 

     $(".flash_shareable").click(function() { 
     parent.$.colorbox.close(); 
     $.colorbox({href:"faq.html", iframe:true, width:800 + "px", height:600 + "px", open:true}); 
    }) 
}); 

IFRAME的HTML,从中我试着去打开另一ligthbox:

<button class="flash_shareable" type="button">open flash</button> 

回答

0

我固定的,但我仍然认为有需要的东西^ _^它不能在Internet Explorer 8和以下,我希望任何人都可以帮助我一直到那个?请:)

$(document).ready(function(){ 
     var y = $(document.body).height(); 
     var x = $(document).width(); 
     parent.$.colorbox.resize({innerWidth:x, innerHeight:y}); 

     $('.iframe').colorbox({iframe:true}); //ligthbox 

     $(".flash_shareable").click(function() { 

     $.colorbox({href:"faq.html", iframe:true, open:true}); 
    }) 
}); 
+0

尽量不要附加'colorbox'一个元素,如下所示:'$ .colorbox({IFRAME:真,HREF:yourUrl});'。并在'click'功能结束时修复丢失的';'。 –

+0

我刚刚测试过,它只适用于Firefox n IE9,不适用于Chrome或IE8。 – STEEL

相关问题