views:

39

answers:

2

I already know this solution. (transfer the slow loading page to a loading-interim-page which shows the animation and then redirects to the actual page)

But I would really like to solve this without a redirecting page. Any clue how ? The redirect will be triggered from codebehind...

A: 

Here is an example with jQuery.
http://pure-essence.net/2010/01/29/jqueryui-dialog-as-loading-screen-replace-blockui/

And one more simple
http://javascript.internet.com/css/pre-loading-message.html

Aristos
As this merely is a matter of 'cosmetics', I don't intend to work on a proper solution, but am looking for an "out of the box solution". I'd be suprised if I there were no solutions available...but then again, I couldn't find what I was looking for on a google...
dll32
+1  A: 

You could try something like this:

<head>
...
<script type="text/javascript">
    if (document.documentElement) {
        document.documentElement.className = 'loading';
    }
</script>
...
</head>

Stick that in your <head> tag, then add some CSS to hide everything on the page except for your loading animation. For example:

.loading > body > * {
    display:none;
}
.loading body {
    background:#fff url(../images/loading.gif) no-repeat 50% 50%;
}

Then add some JavaScript to clear the html tag's class name when the page has finished loading:

// Using jQuery
$(document).ready(function() {
    ...
    $(document.documentElement).removeClass('loading');
    ...
});

Hope this helps.

Ian Oxley
Not exactly what I was looking for, but going into the right direction. Thanks for your suggestion.
dll32
@dll32 You might be able to add some nice transitions from the *loading* animation to the full page with some calls to fadeIn() / fadeOut()
Ian Oxley