let loadingsReg; var count = 0; let images = [ "/assets/css/img/background.jpg", "/assets/css/img/fire_din.png", "/assets/css/img/characters_stat.png", "/assets/css/img/fx_din.png", "/assets/css/img/front_din.png", "/assets/css/img/start.png" ]; var amt = images.length; $('#load-amt').text(amt); loadingsReg = setInterval(function(){ for(var key in images){ console.log(images[key]); let img = new Image(); img.src = images[key]; img.onload = function(){ count++; } img.onerror = function(){ alert('Ошибка загрузки:' + this.src); } } $('#load-amt-progress').text(count); if(count >= amt){ $('#loadings').fadeOut(); $('#progress-reg-main').fadeIn(); clearinterval(loadingsReg); loadingsReg = false; } }, 300);