Hello website loader in wix studio or editor X

Question:
Hello, Do You have an idea how to do website loader in wix studio or editor X ?

*Product:
Wix Editor, Wix Studio Editor, Editor X

thanks for answer

What do you mean, when you say → Website-Loader?

You mean, how to integrate a website-PRELOADER ?

1 Like

@CODE-NINJA
oh yes i do apologize i meant preloader but i reckon everyone would understand - to be more precise - preloader | loader | also between page transitions I know it enhances user experience by providing a visual indication of ongoing processes, contributing to a smoother and more seamless navigation between pages. When dealing with extensive data or resource-intensive elements also gives some time to load : slight_smile :

Here my own creation…

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Page Loading Progress</title>
  <style>
    body {
      margin: 0;
      font-family: 'Arial', sans-serif;
      background-color: #f0f8ff; /* Nice blue background color */
    }

    .progress-bar-container {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 4px;
      background-color: #87CEEB; /* Nice blue color */
      z-index: 9999;
    }

    .progress-bar {
      height: 100%;
      background-color: #4682B4; /* Slightly darker blue color */
      width: 0;
      transition: width 0.3s ease, opacity 0.5s ease; /* Adjusted transition timing */
    }

    .preloader-container {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 9999;
      opacity: 1;
      transition: opacity 0.5s ease, visibility 0.5s ease; /* Added visibility transition */
      text-align: center;
    }

    .preloader {
      width: 60px;
      height: 60px;
      border-radius: 50%;
      border: 6px solid #4682B4; /* Slightly darker blue color */
      border-top: 6px solid transparent;
      animation: spin 1s linear infinite;
      margin-bottom: 16px;
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
  </style>
</head>
<body>
  <div class="preloader-container" id="preloaderContainer">
    <div class="preloader"></div>
    <p style="color: #4682B4;" id="loadingPercentage">0%</p> <!-- Matching the preloader color -->
  </div>

  <div class="progress-bar-container" id="progressContainer">
    <div class="progress-bar" id="progressBar"></div>
  </div>

  <script>
    function simulatePageLoadingProgress() {
      var percentage = 0;
      var progressBar = document.getElementById('progressBar');
      var preloaderContainer = document.getElementById('preloaderContainer');
      var progressContainer = document.getElementById('progressContainer');
      var loadingPercentage = document.getElementById('loadingPercentage');

      function simulateLoading() {
        if (percentage <= 100) {
          updateProgressBar(percentage);
          loadingPercentage.textContent = percentage + '%';
          percentage += 1;
          setTimeout(simulateLoading, 20);
        } else {
          // Delay the hiding of preloader and progress bar to allow the progress bar to reach full width
          setTimeout(function () {
            preloaderContainer.style.opacity = '0';
            progressContainer.style.opacity = '0';
            progressBar.style.transitionDuration = '0.5s'; // Adjusted transition timing for smooth disappearance
            preloaderContainer.addEventListener('transitionend', function () {
              preloaderContainer.style.visibility = 'hidden';
              progressContainer.style.display = 'none';
              // document.body.style.opacity = '0'; // Removed opacity transition from the body
            }, { once: true });
          }, 500); // Delay in milliseconds (adjust as needed)
        }
      }

      simulateLoading();
    }

    function updateProgressBar(percentage) {
      var progressBar = document.getElementById('progressBar');
      progressBar.style.width = percentage + '%';
    }

    document.addEventListener("DOMContentLoaded", function () {
      simulatePageLoadingProgress();
    });
  </script>
</body>
</html>
  1. Navigate to your sites DASHBOARD
  2. → SETTINGS
  3. CUSTOM-CODE
  4. Paste the shown code into the CUSTOM-CODE-FIELD
  5. Select → HEADER
  6. Loading always
  7. Save
  8. Have fun

I was not able to turn it into a real-preloader, but it simulates a real-preloader-cycle
Maybe i will improve it one day.

1 Like

@CODE-NINJA thanks dima will def try :smiley:

Let me know if it worked for you

1 Like