【发布时间】:2020-03-17 20:55:20
【问题描述】:
我设置脚本来加载我的 iframe,但我看到该脚本加载到快速 iframe 内容,我不知道如何设置为后台加载所有 css 图像内容,然后显示完整的 iframe 内容?
我的代码:
<style>
#test123 {
display: none;
}
</style>
<script>
jQuery(document).ready(function( $ ){
$('iframe').on('load', function() {
jQuery("#test123").css("display","block");
},)
});
</script>
<iframe id="test123" src="https://www.mydomain.co/iframe" height="200" width="300"></iframe>
【问题讨论】:
-
iframe 是否动态加载内容?没有任何事件会自动等待。
-
等待它的唯一方法是在 iframe 完成加载所有内容后使用
postMessage()。 -
那是java脚本?我如何在我的代码中实现你能不能试着写代码让我明白你的意思? @Barmar
标签: javascript jquery html iframe