ifream加载完成后根据实际高度加载ifream高度 避免出现多个滚动条

版权声明:网上学习笔记,共享。 https://blog.csdn.net/qq_37346607/article/details/83584077

$("#iframe_280").on("load",function(){   //  iframe加载完后(防止你的ifream还没有加载完成 报错) 高度自适应。
            debugger;
            var frameObj = document.getElementById("iframe_280").contentDocument ||                                                                                                             document.getElementById("iframe_280").contentWindow.document;


            var mainWrapHeight = $(window).height() - 49 - 21;


            var frame_height = frameObj.documentElement.scrollHeight;  


            $("#iframe_280").height( frame_height < 860 ? mainWrapHeight : frame_height);
         });

猜你喜欢

转载自blog.csdn.net/qq_37346607/article/details/83584077