iframe随记

本文介绍了如何使用jQuery在网页中根据底部菜单变化动态调整iframe的高度,确保其与页面布局无缝配合。通过监测窗口大小变化,实时更新iframe的高度,解决了$(...)[0].contentWindow.xxx is not a function这类常见问题。
摘要由CSDN通过智能技术生成

// 根据底部菜单的大小调整iframe的大小

$(window).resize(function(){
                iframeHeight();
            });    
             iframeHeight();
                
    function iframeHeight(){
            var sHeight=document.documentElement.clientHeight;
                    var bottom_height=document.documentElement.clientWidth/375*58;
            $(".iframe").css("height",(sHeight-bottom_height)+"px");
                         // console.log(sHeight-bottom_height)
                         // console.log($(".iframe").css("height"));
                         // console.log($(".iframe").css("height"));
        };

.nav_bj {bottom: 0;left: 0;width: 7.5rem;height: 1.16rem;}

.adiv {width: 100%;height:100%;position: fixed;top: 0rem;left:0rem;}
.iframe {width: 100%; height: 100%; top: 0;left: 0;border: none;margin: 0;position: absolute;background: none;}

//iframe数据获取方式

iframe中如何获取子级和父级元素方法总结_51CTO博客_Iframe从父级获取子级问题

疑难杂症:报错 $(...)[0].contentWindow.xxx is not a function

$(...)[0].contentWindow.xxx is not a function_iframewin.contentwindow.submithandler is not a fun-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值