Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
           });
}
like image 817
randy Avatar asked Nov 06 '22 05:11

randy


1 Answers

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.

like image 65
Scott Brady Avatar answered Nov 10 '22 19:11

Scott Brady