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.

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

报告相同问题?

悬赏问题

  • ¥60 Qcustomplot绘制实时动态曲线
  • ¥20 运用matlab画x-y图
  • ¥15 用idea运行项目,运行tomcat报错:断言失败
  • ¥15 Sqlserver查询链接服务器数据问题
  • ¥15 Bibtex4Word 引用中文文献
  • ¥20 用opencv c/c++ 转换成灰度图,然后做一下直方图均衡,输出mp4文件
  • ¥20 matlab中的双层数值积分
  • ¥50 服务器打印水晶报表问题
  • ¥30 gradle环境下javafx项目如何使用druid连接池
  • ¥15 服务器打印水晶报表问题