jQuery 主体淡入
我想知道如何在页面刷新时创建主体淡入淡出?您可以在 - saporiexports.com 查看示例。这种 jQuery 效果对页面性能有多大影响?
我在该页面上发现的唯一可能与该效果相关的东西是
//PRELOAD SITE
$(window).load(function(){
$('#preloader').fadeOut('slow',function(){$(this).remove();});
});
HTML 中的 div,但我认为这是某种重新加载器。但这个页面不需要它(也许我错了)。
当然你可以做这样的事情 -
$(function() {
$('body').hide().fadeIn('slow');
});
它确实有效,但我认为这不是正确的方法。
编辑 现在我看到他们使用覆盖 div 来管理该效果
div#preloader {
background: url("../workimage/ajax-loader.gif") no-repeat scroll center center #000000;
height: 100%;
position: fixed;
width: 100%;
z-index: 999;
}
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();});
});
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.
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该网站所做的是将覆盖层覆盖在整个页面上并将其淡出。我认为这并不重要,您可以测试这两种方法,看看哪种更快
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
似乎是我创造这种效果的好方法。性能并没有真正受到此影响。它只是隐藏身体,然后再次显示出来。只是一个单一的光过程。
Greetz,
XpertEase
Seems like a good way to create that effect by me. The performance isn't really affected by this. It just hides the body, and then shows it again. Just a single light process.
Greetz,
XpertEase