jQuery hide()div直到完全加载

jQuery hide()div直到完全加载,jquery,css,show-hide,Jquery,Css,Show Hide,我正在为我的博客使用标签式特色文章。如何实现div#最新功能将hide()然后show()在内容完全加载后返回 $(document).ready(function() { //Default Action $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content

我正在为我的博客使用标签式特色文章。如何实现
div#最新功能
hide()
然后
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

标题1的内容

为什么我要隐藏最新的特色节目,因为。。什么时候这里有image@script。。选项卡内容将全部折叠并破坏我的设计

标题1的内容

为什么我要隐藏最新的特色节目,因为。。什么时候这里有image@script。。选项卡内容将全部折叠并破坏我的设计

例如,我有一个id为
#最新功能的div
,我想将其隐藏,直到内容完全加载,然后在加载所有内容后再显示


如何实现上面的当前代码。

为什么不在加载数据之前将div设置为display:none,然后删除display:none。。。还有很多方法可以实现我刚才提到的btw(例如jQuery.toggle(true))

可能最好是这样做:

<div id="latest-features" style="display:none;"></div>

$(function() {
    // do work
    $("div#latest-featured").show();
}

$(函数(){
//工作
$(“最新特色节目”).show();
}

默认情况下隐藏任何内容通常不是一个好主意,但这会满足您的要求。

如果您希望它在加载后显示,请为该div声明CSS
display:none
,然后在$(文档)中调用
$('div#latest featured').show()
.ready函数。

如果希望它在加载后显示,请声明该div的CSS显示:无,然后在
$(文档)中调用
$('div#latest featured').show();


Robert回答得很好,我会投票表决,但还不能……我花了几个小时寻找这个解决方案,这是我发现的最好的解决方案……

你想在哪里使用
#最新功能的
?我在你的代码中看不到任何线索。问题是,如果你的javascript出现问题,或者浏览器不支持js,该项目将永远不会显示。
<div id="latest-features" style="display:none;"></div>

$(function() {
    // do work
    $("div#latest-featured").show();
}