Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:30:17+00:00 2026-06-05T19:30:17+00:00

I would like to display a loading bar before the entire page is loaded.

  • 0

I would like to display a loading bar before the entire page is loaded. For now, I’m just using a small delay:

$(document).ready(function(){
    $('#page').fadeIn(2000);
});

The page already uses jQuery.

Note: I have tried this, but it didn’t work for me: loading bar while the script runs

I also tried other solutions. In most cases, the page loads as usual, or the page won’t load/display at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:30:19+00:00Added an answer on June 5, 2026 at 7:30 pm

    Use a div #overlay with your loading info / .gif that will cover all your page:

    <div id="overlay">
         <img src="loading.gif" alt="Loading" />
         Loading...
    </div>
    

    jQuery:

    $(window).load(function(){
       // PAGE IS FULLY LOADED  
       // FADE OUT YOUR OVERLAYING DIV
       $('#overlay').fadeOut();
    });
    

    Here’s an example with a Loading bar:

    const el = (sel, par) => (par || document).querySelector(sel);
    
    function loadbar() {
      const elOverlay = el("#overlay");
      const elProgress = el("#progress");
      const elProgstat = el("#progstat");
      const images = document.images;
      const tot = images.length;
      let c = 0;
        
      if (tot == 0) return doneLoading();
    
      function imgLoaded() {
        c += 1;
        const perc = Math.floor(100 / tot * c) + "%";
        elProgress.style.width = perc;
        elProgstat.textContent = `Loading ${perc}`;
        if (c === tot) return doneLoading();
      }
    
      function doneLoading() {
        elOverlay.style.opacity = 0;
        setTimeout(() => {
          elOverlay.style.display = "none";
        }, 1200);
      }
      
      [...images].forEach(img => {
        const tmpImg = new Image();
        tmpImg.onload = imgLoaded;
        tmpImg.onerror = imgLoaded;
        tmpImg.src = img.src;
      });
    }
    
    addEventListener('DOMContentLoaded', loadbar, false);
    * {
      margin: 0;
    }
    
    body {
      font: 200 16px/1 sans-serif;
    }
    
    img {
      max-height: 10rem;
    }
    
    #overlay {
      position: fixed;
      z-index: 99999;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      background: rgba(0, 0, 0, 0.9);
      transition: 1s 0.4s;
    }
    
    #progress {
      height: 1px;
      background: #fff;
      position: absolute;
      width: 0; /* will be increased by JS */
      top: 50%;
    }
    
    #progstat {
      font-size: 0.7em;
      letter-spacing: 3px;
      position: absolute;
      top: 50%;
      margin-top: -40px;
      width: 100%;
      text-align: center;
      color: #fff;
    }
    <div id="overlay">
      <div id="progstat"></div>
      <div id="progress"></div>
    </div>
    
    <div id="container">
      <img src="https://placehold.co/4000x4000/0bf/000/png" alt="Image 1 description">
      <img src="https://placehold.co/4000x4000/f0b/000/png" alt="Image 2 description">
      <img src="https://placehold.co/4000x4000/bf0/000/png" alt="Image 3 description">
    </div>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to display data from a database onto a content page using
I would like to display an image based on the page ID. The issue
I would like to display an exchange calendar on our intranet using SharePoint or
I would like to display loading.gif when clicking jquery ui dialog with iframe until
I would just like to display something like a dialog (but dialogs are modal
I display images in my WPF app using BitmapImage . However, I would like
I would like to display an animation gif such as loading... in my XAML
I would like to dim the page and show a loading indicator. I got
On my website I would like to display the users Facebook friends, using the
I am dynamically loading usercontrols with Page.LoadControl() and would like to selectively make some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.