Fancybox卡在IE中加载iframe [英] Fancybox stuck loading iframe in IE
问题描述
我在使用fancybox在IE中的iframe中加载PDF时遇到问题。当我点击链接时,我得到了gif加载器,它只是永远旋转。控制台或页面上没有错误或类似的错误。所有版本的IE都会出现问题。所有其他浏览器工作正常。此外,PDF是一个内部文件。
以下是一些代码:
HTML
<!DOCTYPE html>
< html lang =en>
< head>
< meta charset =utf-8>
< link rel =stylesheettype =text / csshref =<?php echo base_url(templates / style1 / css / jquery.fancybox.css)?> />
< script src =<?php echo base_url(js / jquery-1.7.2.min.js)?>类型= 文本/ JavaScript的 >< /脚本>
< script type =text / javascriptsrc =../js / jquery.fancybox.js>< / script>
< / head>
< body>
< a class =fancybox-media italichref =../ contract_docs / dummy.pdf> Test Doc< / a>
< / body>
< / html>
JS
< pre class =lang-js prettyprint-override>
$(document).ready(function(){
/ * fancybox handler * /
$('。fancybox-media ')。fancybox({
openEffect:'none',
closeEffect:'none',
autoSize:true,
type:'iframe'
});
});
编辑:我也试过升级jQuery,但无济于事。
编辑:这是 jsFiddle ,非常简单,不能在我的IE中工作。
似乎禁用预加载修复了iframe的问题和IE所以试试这个:
$(document).ready(function(){
/ * fancybox handler * /
$('。fancybox-media')。fancybox({
openEffect:'none',
closeEffect:'none',
autoSize:true,
输入:'iframe',
iframe:{
preload:false //修复iframe和IE
的问题}
});
});
使用fancybox v2.1.4和IE7进行测试。
检查 JSFIDDLE
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.
Here's some of the code:
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'
});
});
EDIT: I have also tried upgrading jQuery, to no avail.
EDIT: Here is a jsFiddle, really simple and doesn't work in IE for me.
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
}
});
});
Tested with fancybox v2.1.4 and IE7.
Check JSFIDDLE
这篇关于Fancybox卡在IE中加载iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!