I have integrated a tabbed featured post on my blog and I am facing an issue. How can I apply the div#latest-featured
to be hidden using hide()
method and then displayed again once the content is fully loaded?
$(document).ready(function() {
//Default Action
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
return false;
});
});
HTML
<ul class="tabs">
<li><a href="#f1">Title 1</a></li>
<li><a href="#f2">Title 2</a></li>
</ul>
<div id="latest-featured">
<div id="f1" class="tab_content">
<p>Content for title 1</p>
<p>Why I want to hide the #latest-featured because.. when had image @ script here.. the tab_content will collapse all and break my design</p>
</div>
<div id="f2" class="tab_content">
<p>Content for title 1</p>
<p>Why I want to hide the #latest-featured because.. when had image @ script here.. the tab_content will collapse all and break my design</p>
</div>
</div>
For instance, there is a div with the id #latest-featured
and I aim to hide it until the entire content loads completely, and then reveal it once everything has finished loading.
How can this be implemented within the existing code provided above?