請添加此的Jquery的<html>
$(window).on('load', function() { // makes sure the whole site is loaded
$('#loader-wrapper').fadeOut(); // will first fade out the loading animation
$('#loader').delay(500).fadeOut('slow'); // will fade out the white DIV that covers the website.
$('body').delay(350).css({'overflow':'visible'});
})
上面和側面以下它:
<div id="loader-wrapper" class="">
<div id="loader"></div>
</div>
CSS:
/*preloader*/
#loader-wrapper{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
background-color: #222;
}
#loader{
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
/*border: #3498db solid 3px;*/
z-index: 1500;
border-radius: 50%;
border: transparent solid 3px;
border-top-color: #3498db;
animation: spin 2.5s linear infinite;
}
#loader:before{
content: "";
position: absolute;
top: 5px;
bottom: 5px;
right: 5px;
left: 5px;
/*border: #e74c3c solid 3px;*/
border-radius: 50%;
border: transparent solid 3px;
border-top-color: #ff034b;
animation: spin 2s linear infinite;
}
#loader:after{
content: "";
position: absolute;
top: 15px;
bottom: 15px;
right: 15px;
left: 15px;
/*border: #f9c922 solid 3px;*/
border-radius: 50%;
border: transparent solid 3px;
border-top-color: #eee;
animation: spin 1.5s linear infinite;
}
@keyframes spin {
0%{
transform: rotate(0deg);
}
100%{
transform: rotate(360deg);
}
}
下面就以這樣https://codepen.io/mimoYmima/pen/fisgL
我希望這是有用的另一種方式的鏈接。
很好用,接受如何添加一個阻塞屏幕的實際加載器,以便在加載時沒有人點擊任何東西? –
加絕對位置絕對0,0,大小100vh,100vw,透明,z-index 1000 –