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 9207397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:22:41+00:00 2026-06-18T00:22:41+00:00

I found what I was looking for on this link How to show ajax

  • 0

I found what I was looking for on this link How to show ajax loading gif animation while the page is loading? but I dont know how to implement this on my website.

I want a loading GIF to appear while the page loads and disappears by itself once the page is completely loaded with PHP results.

On the website I use one page template (index.php) and I have all data loaded in that page dynamically according to the user’s query.

Thank you in advance.

  • 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-18T00:22:43+00:00Added an answer on June 18, 2026 at 12:22 am

    Well, this is my solution.

    1) CSS part

    #loadgif {
        padding-top:2px;
        font: 10px #000;
        text-align:center;
        vertical-align:text-top;
    
        height: 80px;
        width: 130px;
    
        /* Centering the div to fit any screen resolution */
        top: 50%;
        left: 50%;
        margin-top: -41px; /* Div height divided by 2 including top padding */
        margin-left: -65px; /* Div width divided by 2 */
        position: absolute;
        display:    none; /* JS will change it to block display */
        position:   fixed;
        z-index:    1000;
    
        /* Loading GIF set as background of the div */
        background: #FFF url('../img/loader.gif') 50% 75% no-repeat;
    
        /* Misc decoration */
        -webkit-border-radius: 15px;
        -moz-border-radius: 15px;
        border-radius: 15px;
        border:#7580a8 solid 1px;
    }
    

    2) HTML part

    Place div tag within body tag anywhere.

    <!-- With or without text -->
    <div id="loadgif">Loading...</div>
    

    3) Javascript part

    I made two functions, one to show and another to hide the div.

    <script type="text/javascript">
    
    // Hide function by changing <div> style display attribute back to none
    function hideloadgif() {
        document.getElementById('loadgif').style.display = 'none';
    }
    
    // Show function by changing <div> style display attribute from none to block.
    function showloadgif() {
        document.getElementById('loadgif').style.display = 'block';
    }
    
    // Making sure that any other event running in the background isn't affected
    if (window.addEventListener) { // Mozilla, Netscape, Firefox
        window.addEventListener('load', WindowLoad, false);
    } else if (window.attachEvent) { // IE
        window.attachEvent('onload', WindowLoad);
    }
    
    // Call the hideloadgif() function on click event,
    // with interval time set to 3 seconds to hide the <div>
    function WindowLoad(click) {
        setInterval("hideloadgif()",3000)
    }
    </script>
    

    4) Showing the div.
    Call function showloadgif() using onlick=”” event anywhere.

    For example

    <img src="abc/def.jpg" onlick="showloadgif()">
    

    Once the image is clicked, the div will appear and at the same time, hideloadgif() will trigger and hides the div within 3 seconds.

    function WindowLoad(click) {
        setInterval("hideloadgif()",3000)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been looking around for a solution to this thing but I haven't found
I've been looking for an existing answer to this question, but haven't found one.
A while back a found a great-looking framework that allowed .net developers to implement
I've been looking for this answer, and all I found was this link ,
I found this code: link $(.show-more a).on(click, function() { var $this = $(this); var
I found this link http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/ , but there isn't a lot of description around
What do you call this arrow looking -> operator found in PHP? It's either
I found this orientation test code below looking for JQTouch reference material. This works
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
Whilst looking for a B-V color index to temperature conversion formula I found this

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.