You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/resources/views/segments/preloader/PreloaderImage/PreloaderImage.js

23 lines
472 B
JavaScript

let isHidePreloader = false;
const hidePreloader= function (){
if (!isHidePreloader){
document.querySelector('#website-preloader').style.opacity = 0;
setTimeout(()=>{
document.querySelector('#website-preloader').remove();
},510);
isHidePreloader = true;
}
};
window.addEventListener('load',function () {
hidePreloader();
});
// if field and didn't load after 10s
setTimeout(()=>{
hidePreloader();
},10000);