I'm building the loading system using Jquery.
And they consist of a div that covers all the splice in the browser and that when loading all elements of the page, Jquery hides the div.
The system is working very well, but it is displayed even when the page is very light and fast.
I wanted to know how to make it appear only if the page takes more than 2 seconds to load.
Follow the load code.
$(window).load(function() {
$(".se-pre-con").fadeOut("fast");
});
.se-pre-con {
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 9999;
background: url(https://media0.giphy.com/media/3oEjI6SIIHBdRxXI40/200_s.gif) center no-repeat #FFFFFF;
}
.se-pre-con p {
width: 160px;
height: 15px;
position: absolute;
top: 70%;
left: 48%;
margin-top: -70px;
margin-left: -48px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><!--Loading--><divclass="se-pre-con"><p>PROCESSANDO DADOS</p></div>
blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>blablablablablalba<br>