Currently, I am working on a website and have implemented a preloader to fade in and display the content. However, I am facing an issue where the preloader is not fading as expected and instead continuously loops. Can anyone offer guidance on how to achieve the fading effect successfully? The version of jQuery I am using is 3.2.1. Below is the code snippet I have utilized -
jQuery(document).ready(function($) {
$(window).load(function() {
$('#preloader').fadeOut('slow', function() {
$(this).remove();
});
});
});
#preloader {
position: fixed;
left: 0;
top: 0;
z-index: 999999;
width: 100%;
height: 100%;
overflow: visible;
background: #333 url('http://files.mimoymima.com/images/loading.gif') no-repeat center center;
}
<body>
<div id="preloader"></div>
<p>
This is the page
</p>
</body>