1

I have been trying to display an image in while my page is loading. But as you can see in the screenshot that page is loading before the image. Probably because of sequence.

enter image description here

    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE"/>
    <style>
    div#loading {
        top: 200 px;
        margin: auto;
        position: absolute;
        z-index: 1000;
        width: 160px;
        height: 24px;
        background: url(/images/loadingM.gif) no-repeat;
        cursor: wait;
        }
    </style>
    </head>
<body><div id="loading"></div></body>

And at the bottom of the page I have used this script

window.onload = function(){ document.getElementById('loading').style.display='none';}

But my page is not loading before the content. So, in a nut shell I can't see loading image on page load.

Wasif Kirmani
  • 1,277
  • 3
  • 22
  • 43
  • 1
    window.onload fires when the entire page has loaded. After everything has download and the DOM is ready. See http://stackoverflow.com/questions/588040/window-onload-vs-document-onload. jQuery might be able to help you. Have a look here http://stackoverflow.com/questions/956047/jquery-loading-image-while-elements-loads and here http://stackoverflow.com/questions/8761713/jquery-ajax-loading-image. – Alex Theedom Oct 10 '13 at 13:17

0 Answers0