Preloader Issue

On my Wix site, DoorJam Creations, I created a custom preloader using a custom code. Even though I have it set on “All pages” and “Load code on each new page,” it just appears when I first go to the home page and not when I click on any other links. I’ve tried setting it to “Load only once” with the same result. The preloader, however, also appears on my Internet Archive saves of different pages. Does anybody have any solutions for this?

For completion’s sake, here’s the code:

<div class="preloader">
  <img src="https://static.wixstatic.com/media/2c2b91_0932f302eb02465592031b5948cfd6f9~mv2.gif" alt="safe" class="preloader"></img>
</div>

<style>
  /* Preloader Section class */
      .preloader{
          position: relative;
          width: 100%;
          height: 100vh;
          z-index: 1001;
          text-align: center;
          background-color: #000000;  /* Preloader Background */
          margin: auto;
      }

  /* Preloader Image style */
      .preloader img{
          max-width: 200px;  /*  width of preloader image  */
          width: 38%;
          height: auto;
          margin: auto;
          text-align: center;
          display: block;
          top: 40%;
      }
</style>

<script>
    //after window is loaded completely
    window.onload = function(){
        //hide the preloader
        document.querySelector(".preloader").style.display = "none";
    }
</script>

The way Wix redirects user to a new page is quite difference sometimes. You might need to check the URL changes using interval or other JS functions.

Sorry for the late reply, but is there a resource that goes into more specifics on checking the URL changes using interval or other JS functions? Do I need to enter a specific piece of Javascript code? And where would it go, in the site’s JS part on the “Edit Page” site or somewhere else?

Is there anyway to have the preloader fade out on all page loads for all pages on my site? I’ve tried adding various codes (CSS and Javascript) to my preloader code, but nothing works. When the site loads, it usually just appears on the home page (and only appears on others pages if I refresh those pages after visiting them) and just cuts away.

Does anybody have any specific solutions for this?