【问题标题】:PDF hides Jquery Modal in SafariPDF在Safari中隐藏Jquery Modal
【发布时间】:2014-08-13 02:38:36
【问题描述】:

这与我的this 问题有关。在 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", '');
}
});

你可以看到问题image here.Dialog的右半边被PDF挡住了。

【问题讨论】:

  • 你能在这里展示一下 safari 中的输出如何显示吗?
  • 那么你想要的输出应该是什么?
  • PDF must be at backend. dialog should be in front 对话框已经在前面
  • 为什么不试试 z-index?

标签: javascript jquery css asp.net-mvc safari


【解决方案1】:

特别是,我认为 z-index 可能是要处理的问题,因此您可以通过应用 z-index 来做到这一点

另一方面 Bgiframe 是您应该在

中找到的插件

另一个音符, 在互联网上阅读了一些文章后,我发现 pdf 是由 Acrobat Reader 插件加载的。 它是独立的,与 html 无关 因此,当您调用任何 pdf 或显示任何文件时,它将调用插件并显示您的 pdf 另一方面,如果你有第三方插件,特别是像 acrobad 阅读器,你就无法控制显示器。 所以我的想法来自here

你应该使用两个 iframe 一个例子可以在这里找到

但毕竟如果你设置z-index: -1;position:absolute 和你想要显示的元素(覆盖)设置position:absolutez-index:1 可能是你的解决方案。

我提供了更多从 diff 资源中找到的想法。谢谢

【讨论】:

  • 你可以试试object而不是iframe吗?
  • @Dhwani 你能做个小提琴吗?
猜你喜欢
  • 2014-07-26
  • 2013-12-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-07
  • 1970-01-01
相关资源
最近更新 更多