0

我使用此页面中的示例,它适用于提交案例。

http://www.aspsnippets.com/Articles/Display-loading-image-while-PostBack-calls-in-ASPNet.aspx

但是当用户刷新页面(通过浏览器或 F5 按钮刷新)时,此指示器不显示。我尝试使用卸载/加载事件,但它不起作用。有没有人有任何想法?

提前致谢!

4

2 回答 2

0

这就是你可以用 CSS 做的事情。

http://tjvantoll.com/2013/04/24/showing-a-css-based-loading-animation-while-your-site-loads/

html {
      -webkit-transition: background-color 1s;
      transition: background-color 1s;
    }
html, body {
      /* For the loading indicator to be vertically centered ensure */
      /* the html and body elements take up the full viewport */
       min-height: 100%;
}
html.loading {
      /* Replace #333 with the background-color of your choice */
      /* Replace loading.gif with the loading image of your choice */
      background: #333 url('loading.gif') no-repeat 50% 50%;

      /* Ensures that the transition only runs in one direction */
     -webkit-transition: background-color 0;
     transition: background-color 0;
  }
  body {
        -webkit-transition: opacity 1s ease-in;
         transition: opacity 1s ease-in;
  }
 html.loading body {
     /* Make the contents of the body opaque during loading */
      opacity: 0;

      /* Ensures that the transition only runs in one direction */
    -webkit-transition: opacity 0;
    transition: opacity 0;
}

一旦您的页面加载在底部完成,您就可以编写一个 javascript 来删除加载类。

$( "html" ).removeClass( "loading" );

这是该站点的实时示例。

http://tjvantoll.com/demos/2013-04-24/loading.html

于 2014-11-19T09:41:46.400 回答
0

我在我的 asp.net 项目中使用 Telerik Radmenu,我所做的是在我的母版页中添加具有不同名称的 showProgress javascript,并在 radMenu OnClientItemClicked 上调用 javascript 函数。

如果您不使用 Telerik,请尝试使用标签从导航栏中调用 javascript 函数。测试 在此处输入链接描述

于 2017-03-21T15:36:23.280 回答