隐藏整个页面加载过程的页面加载动画结束很久之前它必须淡出 [英] The page loading animation for hiding whole page load process ends long before It must fade out

查看:181
本文介绍了隐藏整个页面加载过程的页面加载动画结束很久之前它必须淡出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

隐藏页面加载

我使用加载动画来隐藏整个页面加载处理。但它结束很久之前它必须淡出。它会在加载时结束,但在加载完整页后必须淡出

I'm using loading animation for hiding whole page load process. but it ends long before It must fade out. it ends while loading but must fade out after full page load

这里是js

$(document).ready(function(){

    $('#loading').fadeOut(600, function() 
    {
        $("#wrap").fadeIn(1000);
        $("#footer").fadeIn(1000);
    });
});

HTML标记

<html>
<body>
<div id="loading"><img src="core/design/img/load/load.gif" /></div>
<div id="wrap"></div>
<div id="footer"></div>
</body>
</html>

我试图使用以下解决方案隐藏整个页面加载过程。

I'm trying to hide whole page loading process with following solution.

CSS规则:

#loading {
    position:fixed; 
    left:0; 
    top:0; 
    width:100%; 
    height:100%;
    background-image:url("img/load/tr.png"); 
    z-index:100;
}
#loading img {position: absolute; margin-left:-110px; margin-top:-9px; left:50%; top:50%} 

您可以在操作中看到它

推荐答案

c $ c> $(window).load(function(){}); 而不是$(document).ready(function(){});

You need to use $(window).load(function(){ }); instead of $(document).ready(function(){ });

更多信息: $(document).ready vs 。$(window).load

对于禁用javascript的用户:

For users with javascript disabled:

$(document).ready(function(){
    $('body').append('<div id="loading"><img src="core/design/img/load/load.gif" /></div>');
});
$(window).load(function(){ 
    $('#loading').fadeOut(600, function(){
        $("#wrap").fadeIn(1000);
        $("#footer").fadeIn(1000);
    });
});

这篇关于隐藏整个页面加载过程的页面加载动画结束很久之前它必须淡出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆