javascript - How to show Page Loading div until the page has finished loading -
I have a section on our website that loads very slowly as it is making some intense calls.
Any idea how I can say something like "loading" to show the div
, while the page is ready and then everything disappears when ready?
I need it and after some research on the internet I came with it (jQuery's ):
Add it right after the first body tag:
& Lt; / Div & gt;
Then add style class for diwa and image in your CSS:
#loading {width: 100%; Height: 100%; Top: 0; Left: 0; Status: fixed; Display area; Opacity: 0.7; Background color: #fff; Z-index: 99; Text align: center; } # Loading-image {status: absolute; Top: 100px; Left: 240 pixels; Z-index: 100; }
And finally add this JavaScript to your page (preferably at the end of your page, with the closing of the & lt; body & gt;
tag First):
& lt; Script language = "javascript" type = "text / javascript" & gt; $ (Window) .load (function () {$ ('# loading)'. Hide ();}); & Lt; / Script & gt;
Then adjust the background color of the loading partition from the loading image position and help style class.
This is it, just works fine. But of course you have AJAX-loader.gif
nowhere.
Comments
Post a Comment