jQuery主体淡入 [英] jQuery body fade-in

查看:85
本文介绍了jQuery主体淡入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在刷新页面时如何创建主体淡入?您可以在- saporiexports.com 上查看示例.以及这种jQuery效果在多大程度上影响页面性能?

I was wondering how to create body fade in when page is refreshing? You can see example at - saporiexports.com . And how much this kinda jQuery effect affects page performance?

我在该页面上发现的唯一可能与该效果相关的东西是

Only thing that I found on that page witch maybe would be related with that effect is

//PRELOAD SITE
$(window).load(function(){ 
    $('#preloader').fadeOut('slow',function(){$(this).remove();});
});

,而不是HTML <div id="preloader"></div>中的div,但是我认为这是一种重新加载器.但是在此页面中不需要它(也许我错了).

and than div in HTML <div id="preloader"></div>, but I think that is some kind a reloader. But there is no need for it in this page (maybe I am wrong).

您当然可以做这样的事情-

Of course you can do something like this -

$(function() {
$('body').hide().fadeIn('slow');

});

它有效,但是我认为这不是正确的方法.

And it works, but I dont think that is the right way to do that.

编辑 现在,我看到他们使用overlay div来管理该效果

EDIT Now I see that they use overlay div to manage that effect

div#preloader {
    background: url("../workimage/ajax-loader.gif") no-repeat scroll center center #000000;
    height: 100%;
    position: fixed;
    width: 100%;
    z-index: 999;
}

推荐答案

该网站所做的就是在整个页面上放置一个叠加层并将其淡出.我认为这没什么大不了的,您可以测试两种方法以查看哪种方法更快

What that website did was to put an overlay over the whole page and fade it out. I don't think it matters much, you can test both approaches to see which is faster

这篇关于jQuery主体淡入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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