iframe闪烁“白色”负载 [英] iframe flashes "white" on load

查看:158
本文介绍了iframe闪烁“白色”负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用iframe,似乎每当在不透明度背景上加载内容时,它会在正确显示之前闪烁白色约1秒。



似乎它在jQuery脚本准备好之前触发加载的事件。我试过

  style =visibility:hidden; onload =this.style.visibility ='visible'; 

但不起作用。任何其他想法可以摆脱这一点?

解决方案

尝试使用:

  style =display:noneonload =this.style.display ='block'; 

visibility:hidden 隐藏元素,如果它是可见的,它仍然占据空间。 display:none 实际上使元素完全不可见,就好像不存在。


I am using an iframe in my project and it seems that whenever it loads content on a opacity background - it flashes "white" for around 1 second before correctly appearing.

It seems that it fires loaded event before the jQuery script is ready. I have tried

style="visibility:hidden;" onload="this.style.visibility = 'visible';"

but doesn't work. Any other ideas to get rid of this ?

解决方案

Try using:

style="display:none" onload="this.style.display = 'block';"

visibility:hidden doesn't actually "hide" the element as such - it still takes up the space it would if it were visible. display:none actually makes the element completely invisible, as if it doesn't exist.

这篇关于iframe闪烁“白色”负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆