【问题标题】:when using SimpleModal and open an Iframe it is calling the src twice使用 SimpleModal 并打开 Iframe 时,它​​会调用 src 两次
【发布时间】:2010-12-02 01:09:57
【问题描述】:

我正在使用 SimpleModal,并且正在打开一个 Iframe(使用 ff) 它似乎在 ie9 中工作正常,但在 ff 中它调用 iframe src 两次

感谢您的帮助

我调用的代码看起来像

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
           });
}

【问题讨论】:

  • 你能解释一下两次调用frame src是什么意思吗?
  • 我也有同样的问题。我不知道为什么它两次调用 iframe 的定义 src 而不是一次。它调用它,然后再次调用它
  • 这里有同样的问题。这方面有什么进展吗?

标签: iframe simplemodal


【解决方案1】:

我遇到了同样的问题。看插件代码...

// 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;

您可以看到data 已添加到页面正文中,并带有.appendTo('body'); 行,以计算模态的正确尺寸。如果你注释掉这一行,它将阻止 iframe 被调用两次。

// 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% 所以并没有影响到我。

【讨论】:

    猜你喜欢
    • 2014-02-06
    • 1970-01-01
    • 1970-01-01
    • 2021-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多