there is a site http://test2.polesia.com.ua/

there is a script

var preloader = document.getElementById('loader'); window.DOMContentLoaded = function() { if(!preloader.classList.contains('done')) { preloader.classList.add('done'); } }; 

There is no error in the console, help me figure it out, please!

    3 answers 3

    The DOMContentLoaded event occurs when all HTML has been fully loaded and passed by the parser, without waiting for the loading of stylesheets, images and frames. A significantly different load event is used to track only a fully loaded page.

     let preloader = document.getElementById('loader'); window.addEventListener("load", () => { if(!preloader.classList.contains('done')) { preloader.classList.add('done'); } }); 

      Initially, the code was:

       var preloader = document.getElementById('loader'); window.load = function() { if(!preloader.classList.contains('done')) { preloader.classList.add('done'); } }; 

      But, it did not work and I changed the event to DOMContentLoaded in the hope that it will work.

      He decided this:

       $(window).load(function(){ $( '#loader' ).remove(); }); 

      Thanks, everyone who helped!)

         $(document).ready(function(){ $('#loader').addClass('done'); });