消除闪光的内容 [英] Eliminate flash of unstyled content

查看:77
本文介绍了消除闪光的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在网页上停止未定制内容(FOUC)的闪光?

解决方案

避免FOUC是:


  • 将body部分设置为:< body style =隐; onload =js_Load()>


  • 写一个 js_Load c> JavaScript函数: document.body.style.visibility ='visible';




使用这种方法,我的网页的主体保持隐藏,直到加载完整页面和CSS文件。一旦一切都被加载,onload事件使身体可见。所以,网络浏览器保持空白,直到一切都在屏幕上弹出。



这是一个简单的解决方案,但到目前为止它是工作。


How do I stop the flash of unstyled content (FOUC) on a web page?

解决方案

What I've done to avoid FOUC is:

  • Set the body section as: <body style="visibility: hidden;" onload="js_Load()">

  • Write a js_Load() JavaScript function: document.body.style.visibility='visible';

With this approach the body of my web page is kept hidden until the full page and CSS files are loaded. Once everything is loaded, the onload event turns the body visible. So, the web browser remains empty until a point when everything pops up on the screen.

It is a simple solution but so far it is working.

这篇关于消除闪光的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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