<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: 1 Way To Avoid the Flash of Unstyled Content</title>
	<atom:link href="http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: turtle</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-84346</link>
		<dc:creator>turtle</dc:creator>
		<pubDate>Fri, 26 Aug 2011 17:08:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-84346</guid>
		<description>I had some issues first as adding the class with &lt;code&gt;jQuery(&#039;html&#039;).addClass(&#039;js&#039;);&lt;/code&gt;  left the images invisible and the slideshow did not start. I&#039;m using jQuery cycle btw.

My solution was to remove the class when page has loaded, pretty much as someone suggested earlier. Works like a charm, tho I still ended up using overflow:hidden approach in css.
&lt;pre&gt;&lt;code&gt;
jQuery(&#039;html&#039;).addClass(&#039;js&#039;);
jQuery(document).ready(function(){
jQuery(&#039;html&#039;).removeClass(&#039;js&#039;);

jQuery(&#039;#slides&#039;).cycle({
		fx: &#039;fade&#039;,
		speed: 2000,
		timeout: 5000,
	});
});&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I had some issues first as adding the class with <code>jQuery('html').addClass('js');</code>  left the images invisible and the slideshow did not start. I&#8217;m using jQuery cycle btw.</p>
<p>My solution was to remove the class when page has loaded, pretty much as someone suggested earlier. Works like a charm, tho I still ended up using overflow:hidden approach in css.</p>
<pre><code>
jQuery('html').addClass('js');
jQuery(document).ready(function(){
jQuery('html').removeClass('js');

jQuery('#slides').cycle({
		fx: 'fade',
		speed: 2000,
		timeout: 5000,
	});
});</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: turtle</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-84345</link>
		<dc:creator>turtle</dc:creator>
		<pubDate>Fri, 26 Aug 2011 16:49:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-84345</guid>
		<description>Your solution made me feel stupid.... Can&#039;t believe I never thought of that. Thank you, I&#039;ve been struggling with his for some time now.</description>
		<content:encoded><![CDATA[<p>Your solution made me feel stupid&#8230;. Can&#8217;t believe I never thought of that. Thank you, I&#8217;ve been struggling with his for some time now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Niels</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83770</link>
		<dc:creator>Niels</dc:creator>
		<pubDate>Tue, 21 Jun 2011 02:54:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83770</guid>
		<description>I had some issues implementing this in Chrome for some reason. The workaround that seemed to fix it involved changing the &#039;$&#039; to &#039;jQuery&#039;:

&lt;pre&gt;&lt;code&gt;jQuery(&#039;html&#039;).addClass(&#039;js&#039;);
$(document).ready(function() {
// DOM ready functions
});
&lt;/code&gt;&lt;/pre&gt;

Hope that helps someone :-)

(Before anyone comments, yes jQuery is the only library I am using)</description>
		<content:encoded><![CDATA[<p>I had some issues implementing this in Chrome for some reason. The workaround that seemed to fix it involved changing the &#8216;$&#8217; to &#8216;jQuery&#8217;:</p>
<pre><code>jQuery('html').addClass('js');
$(document).ready(function() {
// DOM ready functions
});
</code></pre>
<p>Hope that helps someone :-)</p>
<p>(Before anyone comments, yes jQuery is the only library I am using)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Object hidden onload displays briefly - SitePoint Forums</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83751</link>
		<dc:creator>Object hidden onload displays briefly - SitePoint Forums</dc:creator>
		<pubDate>Sat, 04 Jun 2011 08:32:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83751</guid>
		<description>[...] get around this by hiding the element with CSS but through JavaScript. Either by document write or some other method.  You could of course hide it with css directly but then those with JS disabled won&#039;t get the [...]</description>
		<content:encoded><![CDATA[<p>[...] get around this by hiding the element with CSS but through JavaScript. Either by document write or some other method.  You could of course hide it with css directly but then those with JS disabled won&#039;t get the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Lopez</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83711</link>
		<dc:creator>Daniel Lopez</dc:creator>
		<pubDate>Wed, 18 May 2011 20:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83711</guid>
		<description>Know this is an old post but wanted to post this up for an option as well. It does cause multiple bodies but browsers will correct it. Feedback welome.

&lt;pre&gt;&lt;code&gt;
&lt;!doctype html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .js .omgash{display:none;}
      .js .ohshnap{display:block; color:green;}
      .nojs .omgash{display:block; color:red;}
      .nojs .ohshnap{display:none;}
    &lt;/style&gt;
    &lt;title&gt;js&lt;/title&gt;
  &lt;/head&gt;

  &lt;noscript&gt;
  &lt;body class=&quot;nojs&quot;&gt;
  &lt;!--[if lt IE 7]&gt; &lt;body class=&quot;nojs ie6&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt; &lt;body class=&quot;nojs ie7&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt; &lt;body class=&quot;nojs ie8&quot;&gt; &lt;![endif]--&gt;
  &lt;/noscript&gt;
  &lt;body class=&quot;js&quot;&gt;
  &lt;!--[if lt IE 7]&gt; &lt;body class=&quot;js ie6&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt; &lt;body class=&quot;js ie7&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt; &lt;body class=&quot;js ie8&quot;&gt; &lt;![endif]--&gt;

    &lt;div&gt;
      &lt;b class=&quot;omgash&quot;&gt;No Javascript&lt;/b&gt;
      &lt;b class=&quot;ohshnap&quot;&gt;Javascript&lt;/b&gt;
    &lt;/div&gt;

  &lt;/body&gt;
&lt;/html&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Know this is an old post but wanted to post this up for an option as well. It does cause multiple bodies but browsers will correct it. Feedback welome.</p>
<pre><code>
&lt;!doctype html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .js .omgash{display:none;}
      .js .ohshnap{display:block; color:green;}
      .nojs .omgash{display:block; color:red;}
      .nojs .ohshnap{display:none;}
    &lt;/style&gt;
    &lt;title&gt;js&lt;/title&gt;
  &lt;/head&gt;

  &lt;noscript&gt;
  &lt;body class=&quot;nojs&quot;&gt;
  &lt;!--[if lt IE 7]&gt; &lt;body class=&quot;nojs ie6&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt; &lt;body class=&quot;nojs ie7&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt; &lt;body class=&quot;nojs ie8&quot;&gt; &lt;![endif]--&gt;
  &lt;/noscript&gt;
  &lt;body class=&quot;js&quot;&gt;
  &lt;!--[if lt IE 7]&gt; &lt;body class=&quot;js ie6&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 7]&gt; &lt;body class=&quot;js ie7&quot;&gt; &lt;![endif]--&gt;
  &lt;!--[if IE 8]&gt; &lt;body class=&quot;js ie8&quot;&gt; &lt;![endif]--&gt;

    &lt;div&gt;
      &lt;b class=&quot;omgash&quot;&gt;No Javascript&lt;/b&gt;
      &lt;b class=&quot;ohshnap&quot;&gt;Javascript&lt;/b&gt;
    &lt;/div&gt;

  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: wujitsu</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83702</link>
		<dc:creator>wujitsu</dc:creator>
		<pubDate>Fri, 13 May 2011 15:50:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83702</guid>
		<description>great solution!
Been searching for hiding some dom elements before page loads.
Otherwise I&#039;d have to forget about animation effects.</description>
		<content:encoded><![CDATA[<p>great solution!<br />
Been searching for hiding some dom elements before page loads.<br />
Otherwise I&#8217;d have to forget about animation effects.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alvaro Duran</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83699</link>
		<dc:creator>Alvaro Duran</dc:creator>
		<pubDate>Thu, 12 May 2011 16:37:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83699</guid>
		<description>What I&#039;ve done to avoid FOUC is:

· Set the body section as: &lt;code&gt;&lt;body style=&quot;visibility: hidden;&quot; id=&quot;id_body&quot; onload=&quot;js_Load()&quot;&gt;&lt;/code&gt;

· Write the &lt;code&gt;js_Load()&lt;/code&gt; javascript function as: &lt;code&gt;document.body.style.visibility=&#039;visible&#039;;&lt;/code&gt;

With this approach the body of my web page keeps 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.</description>
		<content:encoded><![CDATA[<p>What I&#8217;ve done to avoid FOUC is:</p>
<p>· Set the body section as: <code>&lt;body style="visibility: hidden;" id="id_body" onload="js_Load()"&gt;</code></p>
<p>· Write the <code>js_Load()</code> javascript function as: <code>document.body.style.visibility='visible';</code></p>
<p>With this approach the body of my web page keeps 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.</p>
<p>It is a simple solution but so far it is working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83657</link>
		<dc:creator>Jerry</dc:creator>
		<pubDate>Tue, 26 Apr 2011 05:58:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83657</guid>
		<description>Hi Karl:
      Thanks for your comments. I find that it still has some issue, Please check below code. You can see each div will have a element p to show some text, so when page load and use Cycle plugin to show these photo1/photo2/photo3, these element p&#039;s text will be overlapped, and they are shown as garbage text, even bind a handler to window load to make those slides visible, the text are all shown as garbage text, Thanks for your further help!

&lt;pre&gt;&lt;code&gt;&lt;div id=&quot;slideshow&quot; class=&quot;slideshow&quot;&gt;
        &lt;div class=&quot;slide photo1&quot; id=&quot;photo1&quot;&gt;
             &lt;p class=&quot;p slide_text&quot; id=&quot;slide1_text&quot;&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;slide photo2&quot; id=&quot;photo2&quot;&gt;
             &lt;p class=&quot;p slide_text&quot; id=&quot;slide2_text&quot;&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class=&quot;slide photo3&quot; id=&quot;photo3&quot;&gt;
             &lt;p class=&quot;p slide_text&quot; id=&quot;slide3_text&quot;&gt;&lt;/p&gt;
        &lt;/div&gt;
&lt;div&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Karl:<br />
      Thanks for your comments. I find that it still has some issue, Please check below code. You can see each div will have a element p to show some text, so when page load and use Cycle plugin to show these photo1/photo2/photo3, these element p&#8217;s text will be overlapped, and they are shown as garbage text, even bind a handler to window load to make those slides visible, the text are all shown as garbage text, Thanks for your further help!</p>
<pre><code>&lt;div id="slideshow" class="slideshow"&gt;
        &lt;div class="slide photo1" id="photo1"&gt;
             &lt;p class="p slide_text" id="slide1_text"&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="slide photo2" id="photo2"&gt;
             &lt;p class="p slide_text" id="slide2_text"&gt;&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="slide photo3" id="photo3"&gt;
             &lt;p class="p slide_text" id="slide3_text"&gt;&lt;/p&gt;
        &lt;/div&gt;
&lt;div&gt;
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83649</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Sat, 23 Apr 2011 14:56:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83649</guid>
		<description>Jerry, Please note the instruction for inserting html tags in your comments: &quot;Use &lt; instead of &lt; and &gt; instead of &gt; in the examples themselves. Otherwise, you could lose part of the comment when it&#039;s submitted.&quot; There is a toolbar button just above the comment field to assist you in doing that.

Now to your question: you could provide a style rule like so:

&lt;pre&gt;&lt;code&gt;.js .slide { visibility: hidden; }
&lt;/code&gt;&lt;/pre&gt;

And then bind a handler to window load to make those slides visible:

&lt;pre&gt;&lt;code&gt;$(window).bind(&#039;load&#039;, function() {
  $(&#039;div.slide&#039;).css(&#039;visibility&#039;, &#039;visible&#039;);
});
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Jerry, Please note the instruction for inserting html tags in your comments: &#8220;Use &amp;lt; instead of &lt; and &amp;gt; instead of &gt; in the examples themselves. Otherwise, you could lose part of the comment when it&#8217;s submitted.&#8221; There is a toolbar button just above the comment field to assist you in doing that.</p>
<p>Now to your question: you could provide a style rule like so:</p>
<pre><code>.js .slide { visibility: hidden; }
</code></pre>
<p>And then bind a handler to window load to make those slides visible:</p>
<pre><code>$(window).bind('load', function() {
  $('div.slide').css('visibility', 'visible');
});
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jerry</title>
		<link>http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-unstyled-content/comment-page-1#comment-83645</link>
		<dc:creator>Jerry</dc:creator>
		<pubDate>Fri, 22 Apr 2011 02:06:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/?p=105#comment-83645</guid>
		<description>Hi Karl:
      Thanks for your reply, Maybe I do not decribe my problem clearly. Please allow me to explain it as below.
      I use JQuery Cycle Plugin to show 3 picture and texts as slides show. I use div to show image, and use a p to show text, and each image will have a related text. currently, these image and test can be shown as slide. however, when page load, I will see a flash of all image and all text are overlapped, after some time, as image and text has fade in/out, image and text can be shown as slide correctly.  My problem is how to avoid all image and text shown incorrectly when page load. Thanks!

***I have added a space in each html tag of below code to avoid this page could not show source code correctly.****

&lt;pre&gt;&lt;code&gt;
 &lt;div id=&quot;slideshow&quot; class=&quot;slideshow&quot;&gt;
        &lt;div class=&quot;slide photo1&quot; id=&quot;photo1&quot;&gt;
              
        &lt;/div&gt;			
        &lt;div class=&quot;slide photo2&quot; id=&quot;photo2&quot;&gt;
             
        &lt;/div&gt;
       &lt;div class=&quot;slide photo3&quot; id=&quot;photo3&quot;&gt;
            
        &lt;/div&gt;
&lt;div&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Karl:<br />
      Thanks for your reply, Maybe I do not decribe my problem clearly. Please allow me to explain it as below.<br />
      I use JQuery Cycle Plugin to show 3 picture and texts as slides show. I use div to show image, and use a p to show text, and each image will have a related text. currently, these image and test can be shown as slide. however, when page load, I will see a flash of all image and all text are overlapped, after some time, as image and text has fade in/out, image and text can be shown as slide correctly.  My problem is how to avoid all image and text shown incorrectly when page load. Thanks!</p>
<p>***I have added a space in each html tag of below code to avoid this page could not show source code correctly.****</p>
<pre><code>
 &lt;div id="slideshow" class="slideshow"&gt;
        &lt;div class="slide photo1" id="photo1"&gt;

        &lt;/div&gt;
        &lt;div class="slide photo2" id="photo2"&gt;

        &lt;/div&gt;
       &lt;div class="slide photo3" id="photo3"&gt;

        &lt;/div&gt;
&lt;div&gt;
</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 7/24 queries in 0.008 seconds using disk: basic
Object Caching 374/386 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 17:48:09 -->
