我正在使用 Fancybox 2.0. 我在一个 iframe 中打开内容。当 iframe 中的内容改变时,如何动态调整弹出窗口的大小?
我谷歌了几个小时,但所有的链接都是针对旧版本(1.3)或死链。
感谢您的帮助!
$.fancybox.open({
padding : 0,
href:'http://www.gamespot.com',
type: 'iframe',
autoSize: true
});
beforeShow: function(){
this.width = $('.fancybox-iframe').contents().find('html').width();
this.height = $('.fancybox-iframe').contents().find('html').height();
}
如果要在框架内运行此程序,您需要从子页面触发parent.$.fancybox.update(),以便调整大小。
这应该可以做到。
$.fancybox({
width:600,
height:300,
autoResize:false
});