Fancybox 在 IE 中卡住加载 iframe [英] Fancybox stuck loading iframe in IE

查看:23
本文介绍了Fancybox 在 IE 中卡住加载 iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用fancybox 在IE 的iframe 中加载PDF 时遇到问题.当我点击链接时,我得到了 gif 加载器,它永远旋转.控制台或页面或类似内容中没有错误.问题出现在所有版本的 IE 中.所有其他浏览器都可以正常工作.此外,PDF 是一个内部文件.

I'm having problems loading a PDF in an iframe in IE using fancybox. When I click the link, I get the gif loader and it just spins forever. No errors in the console or on the page or anything like that. Problem occurs in all versions of IE. All other browsers work fine. Also, the PDF is an internal file.

这是一些代码:


HTML

 <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="utf-8">

        <link rel="stylesheet" type="text/css" href=<?php echo base_url("templates/style1/css/jquery.fancybox.css") ?> />

        <script src=<?php echo base_url("js/jquery-1.7.2.min.js") ?> type="text/javascript"></script>
        <script type="text/javascript" src="../js/jquery.fancybox.js"></script>

    </head>
    <body>
        <a class="fancybox-media italic" href="../contract_docs/dummy.pdf" >Test Doc</a>
    </body>
</html>

JS

    $(document).ready(function(){
        /* fancybox handler */
        $('.fancybox-media').fancybox({
            openEffect  : 'none',
            closeEffect : 'none',
            autoSize: true,
            type : 'iframe'
        });
    });

我也试过升级 jQuery,但无济于事.

I have also tried upgrading jQuery, to no avail.

这是一个 jsFiddle,非常简单,在 IE 中不起作用我.

Here is a jsFiddle, really simple and doesn't work in IE for me.

推荐答案

似乎禁用预加载修复了 iframes 和 IE 的问题,所以试试这个:

It seems like disabling pre-loading fixes the issue with iframes and IE so try this :

  $(document).ready(function () {
      /* fancybox handler */
      $('.fancybox-media').fancybox({
          openEffect: 'none',
          closeEffect: 'none',
          autoSize: true,
          type: 'iframe',
          iframe: {
              preload: false // fixes issue with iframe and IE
          }
      });
  });

使用fancybox v2.1.4 和IE7 测试.

Tested with fancybox v2.1.4 and IE7.

检查JSFIDDLE

Check JSFIDDLE

这篇关于Fancybox 在 IE 中卡住加载 iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆