when using SimpleModal and open an Iframe it is calling the src twice

谁说我不能喝 提交于 2019-12-23 11:17:10

问题


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

Thanks for any help

the code i am calling looks like

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

回答1:


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;

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;

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.



来源:https://stackoverflow.com/questions/4330774/when-using-simplemodal-and-open-an-iframe-it-is-calling-the-src-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!