iframe高度

            //主页面去除滚动条,仅iframe内有滚动条
            var menuFrame = document.getElementById('menuFrame');

            //赋予iframe初始高度
            menuFrame.height = window.innerHeight - document.getElementById('navHeader').offsetHeight - document.getElementById('navFooter').offsetHeight;

            //窗口大小变化时iframe高度随之变化
            window.addEventListener('resize', function () {
                menuFrame.height = window.innerHeight - document.getElementById('navHeader').offsetHeight - document.getElementById('navFooter').offsetHeight;
            });
posted @ 2021-08-06 12:52  vvull  阅读(136)  评论(0编辑  收藏  举报