0

我有一个简单的设置http://denishoctor.me/readertest.html(下面的代码)。该按钮在嵌入的 pdf 上打开一个对话框。除了 IE6/7/8 之外,这在所有方面都很好。

有谁知道如何阻止这个?

谢谢,丹尼斯

<button type="button">Click Me</button>

<iframe id="iFrameResponse" style="margin-left:250px;height:500px;width:100%" src="http://knowwheretheygo.org/media//static/content/sample.pdf"></iframe>

<div id="InformationDialog" style="display: none;">This is my info</div>

<script type="text/javascript">
  $(document).ready(function() {
      $( "#InformationDialog" ).dialog( {
          title: "Information",
          autoOpen: false,
          hide: "slide",
          show: "slide",
          width: 225,
          position: [100,125],
          height: 400
      } );

      $("button").click(function() {
        $("#InformationDialog").dialog('open'); return false; 
      });
   });
</script>

更新:我找到了http://groups.google.com/group/jquery-ui/browse_thread/thread/66c7d2d31feedea9?fwc=1。WHich 谈论http://brandonaaron.net/code/bgiframe/docs/。如前所述,任何人都知道需要进行哪些更改才能使其在 IE 中为 PDF 工作?

4

2 回答 2

1

好的,所以这当然不是理想的,但它有效,而且我还没有看到其他任何东西。也只对 IE6/7/8 这样做,不要惩罚那里的好浏览器:

在弹出窗口下方和 PDF 上方粘贴 iFrame。为 jQueryUI 对话框关闭拖动和调整大小后,效果很好。打开它们后,由于我认为是重绘和位置,似乎有一些闪烁。

示例可以在@http ://denishoctor.me/examples/iframepdf/test.html找到

于 2011-05-16T01:37:59.910 回答
1

我的技术是简单地调整/隐藏 iframe。Safari 需要调整 iframe 的大小。

     $("#pdf").css("visibility", "hidden");
     if (navigator.userAgent.indexOf("Safari") > -1) {
        $("#pdf").height("5px");
      }
      $("#dialog-modal").dialog({
            height: 350,
            width: 800,
            buttons: [
            {
                text: "Close",
                click: function() {
                    $("#pdf").css("visibility", "visible");
                        if (navigator.userAgent.indexOf("Safari") > -1) {
                          $("#pdf").height("500px");
                        }
                }
            }],

            close: function(event, ui) {
                $("#pdf").css("visibility", "visible");
                if (navigator.userAgent.indexOf("Safari") > -1) {
                    $("#pdf").height("500px");  //whatever the height of your PDF iframe is
                }
            }
});
于 2012-06-05T22:55:25.683 回答