当使用SimpleModal并打开Iframe时,它会调用src两次 [英] when using SimpleModal and open an Iframe it is calling the src twice
问题描述
我正在使用SimpleModal,我正在打开一个iframe(使用ff)
它似乎在ie9中工作正常但在ff中它调用iframe src两次
I am using SimpleModal and i am opening an Iframe (using ff) it seems to work ok in ie9 but in ff it is calling the iframe src twice
感谢您的帮助
我调用的代码看起来像
function addNew(){
var src = "/php/ftp/parsehome.php?dir="+userDir+"&idx=new";
$.modal('<iframe src="' + src + '" height="445" width="800" style="border:0">', {
containerCss:{
backgroundColor:"#E1EFF7",
borderColor:"#00A99D",
height:450,
padding:0,
width:840
},
modal: true
});
}
推荐答案
我遇到了同样的问题。查看插件代码......
I ran into the same problem. Looking at the plugin code...
// add styling and attributes to the data
// append to body to get correct dimensions, then move to wrap
s.d.data = data
.attr('id', data.attr('id') || s.o.dataId)
.addClass('simplemodal-data')
.css($.extend(s.o.dataCss, {
display: 'none'
}))
.appendTo('body');
data = null;
您可以看到数据
已添加到带有 .appendTo('body');
行的页面正文,用于计算模态的正确尺寸。如果你注释掉这一行,它将阻止iframe被调用两次。
You can see the data
is added to the page body with the line .appendTo('body');
to calculate the correct dimensions for the modal. If you comment out this line, it will prevent the iframe being called twice.
// add styling and attributes to the data
// append to body to get correct dimensions, then move to wrap
s.d.data = data
.attr('id', data.attr('id') || s.o.dataId)
.addClass('simplemodal-data')
.css($.extend(s.o.dataCss, {
display: 'none'
}));
data = null;
不确定此修改是否会导致模态尺寸错误,但我的iframe已设置到 width = 100%
和 height = 100%
所以不影响我。
Not sure if this modification will cause your modal size to have the wrong dimensions, but my iframe was set to width=100%
and height=100%
so didn't affect me.
这篇关于当使用SimpleModal并打开Iframe时,它会调用src两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!