在CSS文件中添加以下CSS。
/** Body Overlay **/
body #load {
display: block;
height: 100%;
overflow: hidden;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 9901;
opacity: 1;
background-color: #FFFFFF;
visibility: visible;
-webkit-transition: all .35s ease-out;
transition: all .35s ease-out;
}
body #load.loader-removed {
opacity: 0;
visibility: hidden;
}
.spinner-loader .load-wrap {
background-image: url("images/loader.png");
background-position: center center;
background-repeat: no-repeat;
text-align: center;
width: 100%;
height: 100%;
}
在网站的开始标签后添加以下代码。
<div id="load" class="spinner-loader"><div class="load-wrap"></div></div>
<script type="text/javascript">
// Javascript function to display loader on page load
document.addEventListener("DOMContentLoaded", function(event) {
var $load = document.getElementById("load");
var removeLoading = setTimeout(function() {
$load.className += " loader-removed";
}, 500);
});
</script>
希望这有帮助。。!!