jquery全屏显示iframe,缩放页面iframe高度自动变化

jquery全屏显示iframe,缩放页面iframe高度自动变化

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>测试环境</title>
    <style type="text/css">
        *
        {
            margin: 0;
            padding: 0;
            list-style-type: none;
        }
    </style>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function () {

        var iframeHeight = function () {
            var _height = $(window).height();
            $('#content').height(_height);
        }
        window.onresize = iframeHeight;
        $(function () {
            iframeHeight();
        });

    });

</script>

<div id="container" style="overflow:hidden;">
    <iframe border="0" id="content" src="http://www.qq.com/" frameborder="0" height="100%" width="100%"></iframe>
</div>
</body>
</html>

 

posted @ 2020-08-27 11:15  WebApi  阅读(789)  评论(0编辑  收藏  举报
CopyRight © 博客园 WebAPI