dongyan9838 2012-07-26 07:42
浏览 45

Fancybox - 无法在iframe中打开类似Facebook的框

am new to js and have tried to open a fancybox iframe containing my facebook fan page like box upon the first load of my website with no success. I have made all the calls to the js files in fancybox and the apropriate css in the header section I am trying to include code in the index page in order to display the iframe on page load with no success, the iframe just doesn't show. here's the code that i use:

<script type="text/javascript">
$(document).ready(function() {
    $(".iframe" ).fancybox({
        'width'             : '75%',
        'height'            : 440,
        'autoScale'         : false,
        'transitionIn'      : 'none',
        'transitionOut'     : 'none',
        'type'              : 'iframe',
        'href'              : "www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FPalindrom%2F104421159704142&amp;width=600&amp;height=258&amp;colorscheme=dark&amp;show_faces=true&amp;border_color=%2399c844&amp;stream=false&amp;header=false&amp;appId=391204344279942"
    });
$(".iframe").eq(0).trigger('click');​        
});
</script>

<a id="iframe"></a>

Solved! thanks guys! managed to get it to open using the $.fancybox with no need for an anchor. Here's the code i used maybe it will help someone else that is also a novice when it comes to jquery and fancybox (i also added a delay timer):

<script type="text/javascript">
setTimeout(function() {
  // Do something after 5 seconds

$.fancybox({
    'width'             : 620,
    'height'            : 260,
    'autoScale'         : true,
    'transitionIn'      : 'fade',
    'transitionOut'     : 'elastic',
    'openEffect'        : 'fade',
    'closeEffect'       : 'elastic',
    'type'              : 'iframe',
    'href'              : "http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FPalindrom%2F104421159704142&width=600&height=258&colorscheme=light&show_faces=true&border_color=%2399c844&stream=false&header=false&appId=391204344279942"
});
}, 5000);

  • 写回答

2条回答 默认 最新

  • dongpu1879 2012-07-26 07:54
    关注

    What about adding http:// before www?

    so this option

    'href'  : "www.facebook.com/....
    

    should look like

    'href'  : "http://www.facebook.com/...
    
    评论

报告相同问题?

悬赏问题

  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面