how can i set the time of the loader in this scenario? it works perfectly fine but it was so quick and i tried the inspect element and Network then disable cache and the fast 3G option i just wanna ask if how to set it in like 5 seconds timer
js
window.addEventListener("load",function () {
const loader = document.querySelector(".loader");
loader.className = " hidden"; // class hidden loader
});
html
<div >
<img src="img/Preloader.gif" alt="loading.."/>
</div>
CodePudding user response:
replace your javascript with this
setTimeout(function() {
const loader = document.querySelector(".loader");
loader.hidden = true;
}, 5000);
CodePudding user response:
replacing this javascript will do the trick
setTimeout(function() {
const loader = document.querySelector(".loader");
loader.className = " hidden";
}, 5000);