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 fastreport怎么判断当前页数
  • ¥15 Kylin-Desktop-V10-GFB-Release-JICAI_02- 2207-Build14-ARM64.iso有没有这个版本的系统啊
  • ¥15 能不能通过蓝牙将传感器数据传送到手机上
  • ¥20 100元python和数据科学实验项目
  • ¥15 根据时间在调用出列表
  • ¥15 R 包chipseeker 安装失败
  • ¥15 Veeam Backup & Replication 9.5 还原问题
  • ¥15 vue-print-nb
  • ¥15 winfrom的datagridview下拉框变成了黑色,渲染不成功
  • ¥20 利用ntfy实现短信推送