duanreng3439 2012-05-05 15:34
浏览 68
已采纳

如何使用fancybox在iframe中调用外部php

i cant open a iframe using fancybox which is calling the external php script file and this is the anchor tag i used to call <a id="iframe" href="gallery.php" >Gallery</a>

jQuery(document).ready(function() {
      jQuery("#iframe" ).fancybox({
        'width'             : '75%',
        'height'            : 885,
        'autoScale'         : false,
        'transitionIn'      : 'none',
        'transitionOut'     : 'none',
        'type'              : 'iframe',
        'href'              : "gallery.php"
    });

});

the gallery.php file is on same folder also the calling page is also on php

  • 写回答

1条回答 默认 最新

  • douzhuan1467 2012-05-11 16:48
    关注

    Please go through this list and make sure you have done each one:

    • Included the jquery library and ensured it is including it correctly (this can be done by using "firebug" and the "net" tab).
    • Included both the fancybox css and javascript library, again checking they have both been included successfully.
    • Try using an exact path e.g http://www.test.com/gallery.php

    Here is an example of what your html file should look like:

    <script type="text/javascript" src="http://www.test.com/jquery-1.4.3.min.js"></script>    
    <script type="text/javascript" src="http://www.test.com/jquery.fancybox-1.3.4.pack.js"></script>
    <link rel="stylesheet" type="text/css" href="http://www.test.com/jquery.fancybox-1.3.4.css" media="screen" />
    
    <script type="text/javascript">
        $(document).ready(function() {
            $("#iframe" ).fancybox({
                'width'             : '75%',
                'height'            : 885,
                'autoScale'         : false,
                'transitionIn'      : 'none',
                'transitionOut'     : 'none',
                'type'              : 'iframe',
                'href'              : "http://www.test.com/gallery.php"
            });
        });
    </script>
    
    <a id="iframe">Gallery</a>
    

    If you go through these steps and ensure your html looks exactly as I have said, you should have no issues.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用VH6501干扰RTR位,CANoe上显示的错误帧不足32个就进入bus off快慢恢复,为什么?
  • ¥15 大智慧怎么编写一个选股程序
  • ¥100 python 调用 cgps 命令获取 实时位置信息
  • ¥15 两台交换机分别是trunk接口和access接口为何无法通信,通信过程是如何?
  • ¥15 C语言使用vscode编码错误
  • ¥15 用KSV5转成本时,如何不生成那笔中间凭证
  • ¥20 ensp怎么配置让PC1和PC2通讯上
  • ¥50 有没有适合匹配类似图中的运动规律的图像处理算法
  • ¥15 dnat基础问题,本机发出,别人返回的包,不能命中
  • ¥15 请各位帮我看看是哪里出了问题