I defined two functions in Site.Master:
<script type="text/javascript">
var spinnerVisible = false;
function showProgress() {
if (!spinnerVisible) {
$("div#spinner").fadeIn("fast");
spinnerVisible = true;
}
};
function hideProgress() {
if (spinnerVisible) {
var spinner = $("div#spinner");
spinner.stop();
spinner.fadeOut("fast");
spinnerVisible = false;
}
};
</script>
And special section:
<div id="spinner">
Loading...
</div>
Visual style is defined in CSS:
div#spinner
{
display: none;
width:100px;
height: 100px;
position: fixed;
top: 50%;
left: 50%;
background:url(spinner.gif) no-repeat center #fff;
text-align:center;
padding:10px;
font:normal 16px Tahoma, Geneva, sans-serif;
border:1px solid #666;
margin-left: -50px;
margin-top: -50px;
z-index:2;
overflow: auto;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…