如何在模态窗口中显示pdf? [英] How to display a pdf in a modal window?

查看:409
本文介绍了如何在模态窗口中显示pdf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个模态窗口,其中包含一个锚文本。当我点击此链接时,它必须调用其他地方的pdf并在弹出窗口中显示它。我该怎么做?

I have a modal window, which contains an anchor text. When i click on this link, it must call a pdf housed somewhere else and display it in a pop up . How can I do that ?

请帮忙。

推荐答案

你可以使用jQuery UI对话框,你可以从这里下载JQuery ui 下载JQueryUI

You can do this using with jQuery UI dialog, you can download JQuery ui from here Download JQueryUI

首先在< head> 标记内包含这些脚本

Include these scripts first inside <head> tag

<link href="css/smoothness/jquery-ui-1.9.0.custom.css" rel="stylesheet">
<script language="javascript" type="text/javascript" src="jquery-1.8.2.js"></script>
<script src="js/jquery-ui-1.9.0.custom.js"></script>

JQuery代码

<script language="javascript" type="text/javascript">
  $(document).ready(function() {
    $('#trigger').click(function(){
      $("#dialog").dialog();
    }); 
  });                  
</script>

中的HTML代码< body> 代码。使用iframe加载pdf文件

HTML code within <body> tag. Use an iframe to load the pdf file inside

<a href="#" id="trigger">this link</a>
<div id="dialog" style="display:none">
    <div>
    <iframe src="yourpdffile.pdf"></iframe>
    </div>
</div> 

这篇关于如何在模态窗口中显示pdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆