loading 关机效果
2008-07-24 16:48
127 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#modalBackground
{
background-color: gray;
filter: alpha(opacity=70);
opacity: 0.7;
position: absolute;
top: 0px;
left: 0px;
}
#animationDialog
{
position: absolute;
border: solid 1px black;
color: Black;
background-color: #0099cc;
font-family: Arial;
font-size: 8pt;
font-weight: bold;
line-height: 30px;
height: 30px;
padding: 10px;
text-align: center;
}
</style>
<script type="text/C#" runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Thread.Sleep(5000);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div style="height: 2000px;">
</div>
<div style="height: 2000px;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%= DateTime.Now %>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div id="modalBackground">
</div>
<div id="animationDialog">
<img src="loading.gif" alt="Loading" /><br />
加载中
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<script type="text/javascript" language="javascript">
function getClientBounds()
{
var clientWidth;
var clientHeight;
switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
clientWidth = document.documentElement.clientWidth;
clientHeight = document.documentElement.clientHeight;
break;
case Sys.Browser.Safari:
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
break;
case Sys.Browser.Opera:
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
break;
default: // Sys.Browser.Firefox, etc.
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
break;
}
return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
}
function resizeElements()
{
var clientBounds = getClientBounds();
var clientWidth = clientBounds.width;
var clientHeight = clientBounds.height;
var bg = $get("modalBackground");
bg.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth) + 'px';
bg.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight) + 'px';
var st=0;
if (document.body && document.body.scrollTop)
{
st=document.body.scrollTop;
}
if (document.documentElement && document.documentElement.scrollTop)
{
st=document.documentElement.scrollTop;
}
var scrollLeft = (clientWidth/2);
var scrollTop = (clientHeight/2+st);
var dialog = $get("animationDialog");
dialog.style.left = scrollLeft + "px";
dialog.style.top = scrollTop + "px";
}
$addHandler(window, "scroll", resizeElements);
$addHandler(window, "resize", resizeElements);
resizeElements();
</script>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
#modalBackground
{
background-color: gray;
filter: alpha(opacity=70);
opacity: 0.7;
position: absolute;
top: 0px;
left: 0px;
}
#animationDialog
{
position: absolute;
border: solid 1px black;
color: Black;
background-color: #0099cc;
font-family: Arial;
font-size: 8pt;
font-weight: bold;
line-height: 30px;
height: 30px;
padding: 10px;
text-align: center;
}
</style>
<script type="text/C#" runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Thread.Sleep(5000);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div style="height: 2000px;">
</div>
<div style="height: 2000px;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<%= DateTime.Now %>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div id="modalBackground">
</div>
<div id="animationDialog">
<img src="loading.gif" alt="Loading" /><br />
加载中
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<script type="text/javascript" language="javascript">
function getClientBounds()
{
var clientWidth;
var clientHeight;
switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
clientWidth = document.documentElement.clientWidth;
clientHeight = document.documentElement.clientHeight;
break;
case Sys.Browser.Safari:
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
break;
case Sys.Browser.Opera:
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
break;
default: // Sys.Browser.Firefox, etc.
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
break;
}
return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
}
function resizeElements()
{
var clientBounds = getClientBounds();
var clientWidth = clientBounds.width;
var clientHeight = clientBounds.height;
var bg = $get("modalBackground");
bg.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth) + 'px';
bg.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight) + 'px';
var st=0;
if (document.body && document.body.scrollTop)
{
st=document.body.scrollTop;
}
if (document.documentElement && document.documentElement.scrollTop)
{
st=document.documentElement.scrollTop;
}
var scrollLeft = (clientWidth/2);
var scrollTop = (clientHeight/2+st);
var dialog = $get("animationDialog");
dialog.style.left = scrollLeft + "px";
dialog.style.top = scrollTop + "px";
}
$addHandler(window, "scroll", resizeElements);
$addHandler(window, "resize", resizeElements);
resizeElements();
</script>
</form>
</body>
</html>
相关文章推荐
- javascript制作loading动画效果 loading效果
- 移动端页面跳转过程中loading效果的小实现
- Winform 简单实现关机背景变灰效果的对话框
- 一个基于jquery的页面预载入效果(loading)
- 一个基于jquery的页面预载入效果(loading)
- Atitit Loading 动画效果
- Android实现一个带粘连效果的LoadingBar
- [分享] 页面加载(loading)效果兼超时提示
- Android Market的 Loading效果
- js实现的页面加载完毕之前loading提示效果完整示例【附demo源码下载】
- css3实现三种不同的loading加载动画效果
- Android 常用效果(各种进度条,酷炫loading动画,火箭升空,撒花以及趋势图)
- 《IT蓝豹》一个不错的loading效果
- 一个不错的loading效果--IT蓝豹
- js写一个loading效果
- HTML5+CSS3 loading 效果收集
- jQuery扩展easyui.datagrid,添加数据loading遮罩效果代码
- ios开发之简单实现loading动画效果
- 很多人想要的Jquery 加载Loading效果,可以加到自己的项目中,结合Ajax使用
- Android 常用效果(各种进度条,酷炫loading动画,火箭升空,撒花以及趋势图)