doujiong2533 2013-04-12 20:38
浏览 77
已采纳

Facebook页面的iframe中的Fancybox 2页面加载

I'm trying to make an application in a facebook page with the use of fancybox 2 where a page is loaded as an iframe in the fancybox. It works all fine, except in IE (who would've known!).

In my fancybox 2 there is a button that submits a form and sends you to another page. this page is loaded in the same fancybox window as the previous page. When this page is loaded, the height of the fancybox is not adjusted properly, so half of my page is not visible.

What I'm trying to do now is change the height of the fancybox iframe, but I'm already stuck on getting the actual size of the iframe.

here my javascript code in the last page that is loaded in the fancybox iframe:

$(document).ready(function() {
    var inner = $('.fancybox-inner');
    console.log(inner);
});

This console.log gives me 'null' back, which tells me this class does not exist in the page. I have also tried the following:

parent.$('.fancybox-inner');
parent.$('.fancybox-iframe');
$('.fancybox-iframe');
$.fancybox;
parent.fancybox;

my fancybox load:

$(document).ready(function() {
$(".uploadbox").fancybox({
    scrolling : 'no',
    preload   : true,
    type      : 'iframe',
    width     : '623px',
    height    : 'auto',
    autoSize  : true,
    afterLoad : function () { $.fancybox.update(); }, //this does not work
    closeBtn  : false,
        closeClick  : false,
        helpers     : { 
            overlay : {closeClick: false}
        }
    });
});

Any help would be greatly appreciated!

  • 写回答

2条回答 默认 最新

  • doujian1954 2013-04-22 11:09
    关注

    I have never managed to solve this issue. I'll explain to you why:

    Facebook pages use an iframe to show your website into their website. To show another page into fancybox 2 you need to use an iframe too. Because an iframe in an iframe is always giving problems (cross browser and so on), there was no way to give the parent window the height of my fancybox, because of the double iframe. Since the app had to go live, I decided to give it a static height. In the future I will not use Fancybox 2 anymore or any of that matter, it's just one big misery inside Facebook.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?