<style type="text/css">
/*遮罩在加载页面上的div样式*/
.loading{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background: white;
}
/*动态图片*/
.pic{
width: 64px;
height: 64px;
background: url(img/loading.gif);
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
</style>
<script type="text/javascript">
/*定时器加载*/
/*$(function(){
setInterval(function(){
$(".loading").fadeOut();
},3000);
});*/
/*通过加载状态事件*/
document.onreadystatechange = function(){
if(document.readyState == ‘complete‘){
$(".loading").fadeOut();
}
}
</script>
<body>
<div class="loading">
<div class="pic"></div>
</div>
</body>
原文:http://www.cnblogs.com/vijayxu/p/7470266.html