tags:

views:

33

answers:

3

Hi

I want to display a loading animation while my page is loading, and when loading is complete then obviously hide it.

I am working in ASP.NET using Masterpages, just wondering there is a a simple way of doing this using JQuery?

Any pointers would be appreciated.

Thanks

A: 

Consider using UpdateProgress control

Sergej Andrejev
Do you have an example of this?
bigtv
Link I posted has an example at the bottom of the page
Sergej Andrejev
yeah, sorry!!!!
bigtv
This looks interesting, but I am not sure how I would wire this up to the page before everything else loads? Any ideas?
bigtv
+2  A: 

Just place an image with the animated gif on the page. Give it an id of loadingImage and add the following script:

$(document).ready(function(){
    $('#loadingImage').hide();
});

Incidentally, how long is your page taking to load? Is it using AJAX calls to load data? Maybe you should look into this and in the callback handler, call the hide() function on your image.

Daniel Dyson
So simple and interesting , Is there any way while all the page is not loaded completely , The page would be disable ?
Mostafa
Hi @Mostafa, if you want to disable scripts on your page until loaded, the $(document).ready(function...) is the place to initialise them. If you want to do more, post a question with more details.
Daniel Dyson
The page is taking about 5 seconds to load, but in my scenario it is loading in a separate frame so I want some feedback to the user as otherwise you click the link and nothing seems to happen.I have tried your example code but everything seems to happen at once rather than the loading div appearing then disappearing when the main content is loaded.I guess a more complex solution is required with some kind of handler. I am using APP.NET AJAX if something can be done with that.
bigtv
A: 

When both answers above were along the right lines, I could get either do exactly what I needed in my scenario.

However I found the following post that on SO that has provided me the solution I was after.

http://stackoverflow.com/questions/2755041/colorbox-show-simulate-loading-animation-for-iframe-content

Thanks all for your input.

bigtv