I am trying to make it so that there is an overlay on the page till the page is fully rendered. I can do this by using timeouts but that is probably not the right way to do this. Is there a better way to achieve this?
Issue I am having is that $(window).load
doesn't trigger.
JS:
$(document).ready(function() {
$(".overlay").fadeIn();
$(window).on('load', function() {
$(".overlay").fadeOut();
});
});
CSS:
.overlay{
display: none;
position: fixed;
padding: 0;
margin: 0;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .3);
opacity: .8;
pointer-events: none;
}