gpt4 book ai didi

javascript - iframe 在博客博客中不起作用

转载 作者:行者123 更新时间:2023-11-28 13:27:12 26 4
gpt4 key购买 nike

您好,我在我的博主博客中使用 iframe 全高。

使用的 CSS 是:

#iframe {
height: 100%;
width: 100%;
display: block;
border:0;
margin:0;
padding:0;
}

Javascript 是:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>
var height = window.innerHeight;

$(document).ready( function(){
$('iframe').css('height', height);
} );
</script>

HTML 是:

<iframe id="iframe" src="http://mybloggertricks.com"></iframe>

我已经在 Dreamviewer 中使用上述相同的属性对其进行了测试,它在 IE 中也能正常工作。但仅在 blogger 中它不能仅在 IE 浏览器中工作。请帮助我解决这个问题的任何人请帮助。

在此处查看该博客: http://new-temp.blogspot.com/2012/12/my-blogger-tricks.html

最佳答案

iframe来监控他的负载,代码如下:

 var height = window.innerHeight, iframe = $('iframe');
iframe.load(function(){
setTimeout(function(){
iframe.css('height', height);
}, 100);
});

关于javascript - iframe 在博客博客中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14027240/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com