【发布时间】:2014-07-26 00:04:41
【问题描述】:
我在 <iframe> 中显示 PDF,在按钮单击时使用 jQuery 模式弹出窗口。这在除 IE10 之外的所有浏览器中都可以正常工作,其中显示的 PDF 隐藏了模式对话框。
放弃对 IE10 的支持不是一种选择。
我尝试使用 z-index。在这个jsfiddle 中,模态在身体之外,但没有任何作用。我可以在弹出窗口中隐藏 pdf 或更改它的位置,但我的客户不希望这样。我也试过var text = prompt("Alert", "textbox's intial text"); - 旧的javascript,但客户不喜欢那种外观。 我的 TL 不想在模态中使用 iframe。 无论如何我不能在 HTML 后面使用 pdf 吗?
HTML:
<body>
<div id='ClickMe'>Click here!</div>
<br/>
<div>This is more than likely an Adobe issue where it thinks it should be in front all the time no matter what, however it is very annoying that you can't open a dialog over a PDF. Click on the 'Click here!' text above to see this issue occur. Interesting enough if you click the Discuss button in JSFiddle it does the same thing.</div>
<br/>
<iframe src="http://www.ccc.commnet.edu/faculty/sfreeman/cst%20250/jQueryNotes.pdf" style="width:100%; height:700px;" frameborder="1"></iframe>
</body>
jQuery:
var $Dialog_div;
function fnOpenDialog() {
var str = '<div id="dialog" style="display: none;height:60%;" title="On Hold Reason" align="center">'+'<br />'+'<textarea id="messageTextBox" cols="32" rows="3" style="resize:none"></textarea>'+'<div class="row" align="center">'+'<br />'+'</div>'+'<br />'+'</div>';
$Dialog_div = $(str).prependTo('body');
// $Dialog_div = $('<div id=\'ThisDialog\'>Hello</div>').prependTo('body');
$Dialog_div = $('#dialog').dialog({
autoOpen: true,
draggable: true,
resizable: true,
title: 'Dialog',
modal: true,
stack: true,
height: ($(window).height() * 0.95),
width: ($(window).width() * 0.9),
buttons: {
'Yes': function() {
alert($('#messageTextBox').val());
$Dialog_div.dialog('close');
},
'No': function(){
alert('No');
$Dialog_div.dialog('close');
}
}
});
}
$('#ClickMe').click(fnOpenDialog);
如何防止 PDF 覆盖模态? (我正在使用 ASP.NET MVCC 5(C#))
【问题讨论】:
-
如果您将其编辑到问题中会更好。
-
好多了。 +1 并收回简历。
-
对话框打开时隐藏 iframe 怎么样?然后把它放回关闭对话框。
-
@ICanHasKittenz 好吧,我向客户询问了该选项,但他希望将其退回。所以无法隐藏。
标签: c# javascript jquery html internet-explorer