safe
How To Apply A Preloader On A Wix Site 2022
top of page

How To Apply A Preloader On A Wix Site 2022



What are Preloaders?


Preloaders are a crucial part of web design. They provide an opportunity for users to see what's coming and prepare themselves. In this article, we'll cover the different types of preloaders, their use cases, and how they can be used in your next website design; and how to add one to your Wix website.


The first type of preloader is the animated one. These are usually simple animations that show the loading progress in real time. One example is the animated GIF that shows a cloud with raindrops falling down as it fills up with water. The second type of preloader is the loading bar. This type of preloader shows you how much has been loaded so far, and it gives you an idea about how long it will take for everything to load up completely. The third type of preloader is a countdown timer.


Types of Preloaders


The most common type of preloader is animated gif preloader. These preloaders are commonly used on web pages because they provide a feeling of movement and they also look nice, without being too distracting.


Another popular type is waterfall preloader. This type is often used in games and apps to show how much time is remaining before completing a level or finalizing an action. The third type is simple image loader which does not have any animation or movement but instead provides a static image that indicates loading progress.


Why You Should Use JavaScript Loader on Your Website


JavaScript loaders help to improve the loading time, reduce server load and provide a better user experience.

The use of JavaScript loaders is not new, but it has become more popular in recent years. It's because of the widespread use of smartphones and tablets that make websites load faster.

There are a few different types of JavaScript loaders:

  • Script loader: it loads scripts from external files

  • Polyfill loader: it loads scripts for compatibility with older browsers

  • Preload loader: it loads scripts before any page content is loaded


Now Let's See How To Set Up A Preloader on Your Wix Website


Add the code below to the website's header code. To do that, go to your Wix Dashboard, then click Settings, and then select Custom Code. This opens the Custom Code window and here you can add a new custom code. Click Add Custom Code. Paste the code below in the space for "Paste the code snippet here:" Give the code a name, for instance, "Pre-Loader". Select All Pages, select Head, and then Apply.


Make sure you add an image or a gif and you can also change the background color.


<div class="preloader">
  <img src="path/t/your/image" alt="safe" class="preloader"></img>
</div>

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

  /* Preloader Image style */
      .preloader img{
          max-width: 200px;  /*  width of preloader image  */
          width: 100%;
          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>




bottom of page