繁体   English   中英

从iframe中的链接调整fancybox的大小

[英]Resize fancybox from link in iframe

我有一个带有iframe内容的指定大小的花式盒子。 我希望能够从iframe的链接中更改内容,并将fancybox的大小调整为新的指定大小,以容纳新内容。 似乎有一些类似的话题,但我没有运气尝试这些建议,因为我使用的是fancyapps,因此代码略有不同。

这是我所拥有的:

JS:

$("a.fancybox").fancybox({
fitToView: false,

beforeShow: function() {
this.skin.css("background", $(this.element).data('color') || 'F9F9F9');
},

afterLoad: function(){
this.width = $(this.element).data("width");
this.height = $(this.element).data("height");
}
});

链接到页面启动FANCYBOX:

<a class="fancybox fancybox.iframe" data-color="#F9F9F9" data-width="225" data-height="404" href="iframe1.html" data-fancybox-group="gallery-1"> 

链接到IFRAME 1中以更改内容并调整尺寸显示框:

<a href="javascript:parent.jQuery.fancybox.open({href : 'iframe2.html', data-width : '600', data-height : '400', data-fancybox-group : 'gallery-1', data-color : '#F9F9F9'});">Change content</a>

目前,第一个iframe已加载且大小正确,但更改内容链接不起作用。

任何人都可以提供的任何帮助或技巧都将非常有用。 提前致谢。

我注意到您传递了诸如data-width : '600'但它们应为width : '600'

暂无
暂无

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

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