如何停止闪烁的内容 [英] How to stop flash of unstyled content
问题描述
这只是一个简短的问题,我真的没有一个例子,但我使用定制的cms,目前我们没有访问的网页的头部,所以一些css必须放在头顶在页面加载时会导致闪烁的未风格的内容。
This is just a short question, I don't really have an example but the I am using a bespoke cms and at present we have no access to the head of the web page so some css has to be placed outside the head causing a flash of un-styled content on page load.
只是想知道她的任何人是否知道使用jquery或其他东西快速修复以阻止这种情况。
Just wondering if anyone on her knows a quick fix with jquery or something to stop this.
我知道把CSS放在不是in-inline是不好的做法,但我想知道是否有工作轮。
I know putting CSS thats not in-inline is bad practise but I was wondering if there is a work round.
任何帮助赞赏
推荐答案
处理FOUC的基本解决方案是保持隐藏,直到它被正确的样式。
The basic solution to handle FOUC is to keep it hidden until it has been properly styled.
我假设您可以控制显示未经模式化的内容?在这种情况下,将其包装在< div id =some-divstyle =display:none> ... content ...< / div>
。然后使用jQuery在整个文档准备就绪时显示它:
I assume that you have control over the content that is displayed unstyled? In that case, wrap it in a <div id="some-div" style="display:none">... content ... </div>
. Then use jQuery to show it when the entire document is ready:
$(function() { $("#some-div").show(); });
这篇关于如何停止闪烁的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!