Note that there are some explanatory texts on larger screens.

plurals
  1. POFade In/Out of DIV and nested DIV's
    primarykey
    data
    text
    <p>I'm trying to get a scenario working to where I can fade a div in and out, replacing it with a another div. This part I've got working, but my DIV completely disappears if the DIV I fade into has DIV's within it.</p> <p>Example:</p> <pre><code>&lt;center&gt; &lt;ul id="menu"&gt; &lt;li&gt;&lt;a href="#content1"&gt;Home&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&lt;/li&gt; &lt;li&gt;&lt;a href="#content2"&gt;Work&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&lt;/li&gt; &lt;li&gt;&lt;a href="#content3"&gt;Blog&lt;/a&gt;&amp;nbsp;&amp;nbsp;|&lt;/li&gt; &lt;li&gt;&lt;a href="#content4"&gt;Contact&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/center&gt; &lt;hr class="style-main"&gt; &lt;center&gt;&lt;img src="{image:homeHeaderImage}"&gt;&lt;/center&gt; &lt;/div&gt; &lt;div id="contentWrap"&gt; &lt;div id="content1"&gt; Home, content should go here :) &lt;/div&gt; </code></pre> <p>This works, If the contents of DIV "content1" look like this it'll perfectly fade in and out. But, since I want to style the contents of "content1" and "content2" etc, I've placed DIVs inside like so.</p> <pre><code>&lt;div id="contentWrap"&gt; &lt;div id="content1"&gt; &lt;div id="homeContent"&gt; Home, content should go here :( &lt;/div&gt; &lt;/div&gt; </code></pre> <p>This makes it so when I click on the link to fade this particular DIV in turn it completely white with no content. I cannot figure out why it will not render the content.</p> <p>I'm using this for my jQuery script</p> <pre><code>$(function() { $('#contentWrap div').hide(); $('#contentWrap div:first').show(); $('#thumbs a:first').addClass('active'); $('#thumbs a').click(function() { if ($(this).hasClass('active') == true) { return false; } else { $('a.active').removeClass('active'); $(this).addClass('active'); $('#contentWrap div').fadeOut(); var contentToLoad = $(this).attr('href'); $(contentToLoad).fadeIn(); return false; } }); </code></pre> <p>});</p> <p>Here's a jsFiddle, the Home menu item is the one which has the problem. The other ones work fine as you can tell.</p> <p><a href="http://jsfiddle.net/uyAzp/" rel="nofollow">http://jsfiddle.net/uyAzp/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload