admin管理员组文章数量:1336660
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...
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...
Share Improve this question edited Aug 17, 2010 at 15:10 dll32 asked Aug 17, 2010 at 15:04 dll32dll32 2352 gold badges4 silver badges15 bronze badges3 Answers
Reset to default 2You 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.
Here is an example with jQuery.
http://pure-essence/2010/01/29/jqueryui-dialog-as-loading-screen-replace-blockui/
And one more simple
http://javascript.internet./css/pre-loading-message.html
You may see Example This by following this link http://onlineshoping.somee./ This is very easy way to display loading animation, while page is loading each time.
protected void Page_Load(object sender, EventArgs e)
{
if (this.IsPostBack)
{
}
else
{
Response.Write("<div id=\"loading\" style=\" text-align:center; top:100px;\"><p> Please Wait...</p><br/><img src=\"../Your Animation .gif file path\" \"width:400px\"></div>");
Response.Flush();
System.Threading.Thread.Sleep(5000);//You may increase Or decrees Thread Sleep time
Response.Write("<script>document.getElementById('loading').style.display='none';</script>");
}
}
You may download ajax custom animation .gif file from this web site http://ajaxload.info/
I hope it will solve your problem.
本文标签: javascriptRedirect to page with loading animationStack Overflow
版权声明:本文标题:javascript - Redirect to page with loading animation - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742419002a2471278.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论