页面加载中效果实现

2015/03/13 问题一箩筐
1、加载的loading.css
@charset "UTF-8";
/* LOGIN CSS */

.background { 
	display: block; 
	width: 100%; 
	height: 100%; 
	opacity: 0.4; 
	filter: alpha(opacity=40); 
	background:#f1f1f1;
	position: fixed; 
	top: 0; 
	left: 0; 
	z-index: 10000; 
} 
.progressBar { 
	background: white url(../img/loading.gif) no-repeat 10px 10px; 
} 
.progressBar { 
	display: block; 
	width: 148px; 
	height: 28px; 
	position: fixed; 
	top: 50%; 
	left: 50%; 
	margin-left: -74px; 
	margin-top: -14px; 
	padding: 10px 10px 10px 50px; 
	text-align: left; 
	line-height: 27px; 
	font-weight: bold; 
	position: absolute; 
	z-index: 10001; 
} 

注意:background部分的position: fixed;否则,只能在当前区域内遮盖

2、页面引用
<!-- shade div start -->
	<div id="background" class="background" style="display: none; "></div> 
	<div id="progressBar" class="progressBar" style="display: none; ">Loading...</div> 
<!-- shade div end -->
3、遮罩的显示与隐藏
//遮罩效果显示
$("#background,#progressBar").show();
//遮罩效果隐藏
$("#background,#progressBar").hide();

Search

    欢迎关注我的微信公众号

    Yannis的程序人生

    Table of Contents