这是与我有关的事情this https://stackoverflow.com/questions/24052681/pdf-hide-jquery-modal-in-ie问题。在 IE 中,我在对话框中使用 iframe 解决了问题。所以它工作得很好。但在 safari 中,尽管我已将 iframe 纳入对话框中,但我仍然面临问题。 Safari 浏览器版本是5.1.7(7534.57.2).
这是我尝试过的代码:
<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", '');
}
});
你可以看到问题图片在这里。 https://i.stack.imgur.com/RiHGU.png对话框的右半边被 PDF 挡住。