I am using this script I found on the internet, but the fadeout is not working. I want a smooth fadeout.
var loader = document.getElementById('spinner');
window.addEventListener("load", function() {
//Hide the spinner after 2 seconds
setTimeout(function() {
loader.style.display = 'none';
}, 2000);
});
$("#spinner").fadeOut();
<section id="spinner">
<div id="preloader">Loading...</div>
</section>