我正在为我的博客使用选项卡式特色帖子。如何实施div#latest-featured
will hide()
then show()
内容完全加载后它会回来吗?
$(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>
示例我有一个带有 id 的 div#latest-featured
我想隐藏它直到内容完全加载,然后在所有内容加载后将其显示出来。
如何实现上面当前的代码。
也许最好做这样的事情:
<div id="latest-features" style="display:none;"></div>
$(function() {
// do work
$("div#latest-featured").show();
}
默认情况下隐藏任何内容通常不是一个好主意,但这将满足您的要求。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)