好的,我想出了这个,这里是解决方案....更像是破解...但它适用于所有浏览器......而且它的作用:它实际上是MASKS(不会删除它 - >因为我需要通过回调)第一个iframe(去除阴影,内容甚至关闭按钮)和关闭事件后 - 它恢复第一个iframe :)
哦,还有额外的“发布消息”的东西,因为整个网站实际上通过iframe加载(跨域的东西),这是解决方案,在常规iframe中加载fancybox1加载fancybox2弹出...无论如何这太复杂,无法解释,并寻求可行解决方案的任何人 - 在这里你去:
$('.addmember').fancybox({
openEffect : 'elastic',
closeEffect : 'elastic',
fitToView : false,
nextSpeed: 0, //important
prevSpeed: 0, //important
beforeShow: function(){
$_returnvalue = false;
this.width = ($('.fancybox-iframe').contents().find('#popup-add-member').width());
this.height = ($('.fancybox-iframe').contents().find('#popup-add-member').height());
var ifrchild = $('.fancybox-iframe').contents().find('#popup-add-member').height()+60;
parent.$('.fancybox-skin').attr('style', function(i,s) { return s + 'height: '+ifrchild+'px;' });
parent.$('.fancybox-inner').attr('style', function(i,s) { return s + 'height: '+ifrchild+'px;' });
$('.fancybox-wrap').attr('style', 'top: 15px !important;');
parent.$('.fancybox-close').addClass("fancynodisplay");
parent.$('.fancybox-overlay').addClass("fancybox-hidescroll");
$('.fancybox-overlay').addClass("fancybox-hideoverlay");
$('.fancybox-overlay').addClass("fancybox-hidescroll");
$('.fancybox-skin').addClass("fancybox-hideshadow");
parent.$('.fancybox-skin').addClass("fancybox-hideshadow");
parent.$('.fancybox-skin').addClass("fancybox-hideskin");
$('#hide-on-open').attr('style', 'display:none;');
},
afterShow: function(){
},
afterClose : function() {
$('#hide-on-open').attr('style', 'display:block;');
var ifrmain = $('#schedule-members').height();
parent.$('.fancybox-skin').attr('style', function(i,s) { return s + 'height: '+ifrmain+'px;' });
parent.$('.fancybox-inner').attr('style', function(i,s) { return s + 'height: '+ifrmain+'px;' });
parent.$('.fancybox-close').removeClass("fancynodisplay");
parent.$('.fancybox-overlay').removeClass("fancybox-hidescroll");
$('.fancybox-overlay').removeClass("fancybox-hidescroll");
parent.$('.fancybox-skin').removeClass("fancybox-hideskin");
if ($_returnvalue != false && $_returnvalue.response == "OK")
{
// MY CALLBACK FUNCTIONS
}
window.top.postMessage($('#wrap').height()+80, 'myiframe');
},
onUpdate : { autoHeight: true},
beforeLoad : function() {
var ifrchild = $('.fancybox-iframe').contents().find('#popup-add-member').height()+60;
window.top.postMessage(ifrchild, 'myiframe');
},
helpers : {
overlay : {closeClick: false}
}
});
和CSS来实现这一目标:
.fancybox-close.fancynodisplay {
height: 0px !important;
width: 0px !important;
display: none !important;}
.fancybox-overlay.fancybox-hidescroll {
overflow: hidden !important;
}
.fancybox-opened .fancybox-skin.fancybox-hideshadow {
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow:none !important;}
.fancybox-hideskin {
background: none repeat scroll 0 0 rgba(255, 255, 255, 0) !important;
position: relative !important;
text-shadow: none !important;
}
.fancybox-hideoverlay {
background: none;
}
什么是你用它来打开你的fancybox代码?有一些选项可以用来设置最大高度和宽度。 – 2013-02-15 15:30:58
看看示例+我不知道确切的高度 - 它是通过PHP动态生成的... – Peter 2013-02-15 15:36:12
我会尝试(在iframe1.html中)afterShow:function(){parent。$。fancybox.update() }' – JFK 2013-02-15 17:45:32