PDF hides Jquery Modal in Safari

2019-04-25 11:43发布

问题:

This is something related to my this question. In IE, I resolved issue using iframe in dialog. So it works fine. But in safari I am still facing problem though I have taken iframe into dialog. Safari browser version is 5.1.7(7534.57.2).

Here is the code I have tried:

<div>
    <iframe allowtransparency="true" style="width :100%;height:68em" id="FaxPdf" src='@Url.Action("GetPDF", "Base", new { pdfPath = @Model.PDFPath })'></iframe>
</div>
<img id="addPatient" title="Add/Select Patient" src="~/Content/Images/AddNewSmall2.png" style="height:20px;width:20px;cursor:pointer;float:right" />
<div id="dialog" style="width: 100%; height: 100%; background-color: lightgray; display: none; ">
    <iframe id="patientFrame" frameborder="0" marginwidth="0" marginheight="0" style="width:100%;height:60em"></iframe>
</div>

$('#addPatient').click(function () {
  $('#dialog').dialog('open');
});
$('#dialog').dialog({
  autoOpen: false,
  title: 'Add/Select Patient',
  height: 'auto',
  width: '90%',
  position: ['top', 50],
  draggable: false,
  show: 'blind',
  hide: 'blind',
  modal: true,
  open: function (event, ui) {
    $.ajax({
      url: '@Url.Action("ManagePatient","Order")',
      type: 'GET',
      cache:false,
      success: function(data){
      setTimeout(function () {
        var frameSet = document.getElementById("patientFrame");
        var iframedoc = frameSet.document;

        if (frameSet.contentDocument)
          iframedoc = frameSet.contentDocument;
        else if (frameSet.contentWindow)
          iframedoc = frameSet.contentWindow.document;

        if (iframedoc){
          iframedoc.open();
          iframedoc.writeln(data);
          iframedoc.close();
        }
      },400);
    },
    error: function () {
      window.location.href = '@Url.Action("Index","Error")';
    }
  });
},
close: function (event, ui) {
  $("#patientFrame").attr("src", '');
}
});

You can see problem image here. Right half side of Dialog is blocked by PDF.

回答1:

Particularly,i think z-index may be the issue to deal with so you can do it with applying a z-index

on the other hand Bgiframe is the plugin you should find in

One another note, after reading some articles over a internet i found that pdf is loaded by the Acrobat Reader plugin. Its a separte one has nothing to do with html so when you call any pdf or show any file then it will call a plug in and your pdf will be shown on the other hand you have no control over a display if you have third party plugin particularly like a acrobad reader. So my idea which i got from here

You should use two iframe an example could be found here

But after all if you set z-index: -1; with position:absolute and element you want to show (overwrite) set position:absolute and z-index:1 could be a solution for you.

i have provide more ideas which i found from diff resources.thanks