我正在使用選項卡式功能發佈我的博客。如何實現div#latest-featured
將hide()
然後show()
內容完全加載後返回?jQuery隱藏()div直到完全加載
$(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爲#latest-featured
一個div,我想隱藏它,直到內容滿載,然後再顯示回來一切都被加載後。
如何實現上面的當前代碼。
你想去哪裏使用'#latest -featured'?我在你的代碼中看不到任何線索。 – Sarfraz 2010-08-10 18:40:11
ok更新爲html – kampit 2010-08-10 18:47:42