美文网首页
jquery.media.js展示pdf文档

jquery.media.js展示pdf文档

作者: 倪大头 | 来源:发表于2019-05-08 11:02 被阅读0次

传送门:https://github.com/malsup/media

6年没更新了

用<div>创建media方便调整大小,使文档宽高随浏览器变动
$('div.panel_body').media();

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>pdf</title>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <script src="../Sources/JS/HomeScript.js"></script>
    <script type="text/javascript" src="../Sources/JS/jquery.media.js"></script>
    <script type="text/javascript">
        $(function () {
            $('div.panel_body').media();
        });
    </script>
    <style type="text/css">
        html, body {
            margin: 0px;
            height: 100%;
        }

        div.panel_body {
            width: 100%;
            height: 100%;
        }

        iframe.pdf_iframe {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <div class="panel_body">
        <iframe class="pdf_iframe" src="../Sources/PDF/myPDF.pdf"></iframe>
    </div>
</body>
</html>

相关文章

网友评论

      本文标题:jquery.media.js展示pdf文档

      本文链接:https://www.haomeiwen.com/subject/jixmoqtx.html