I am creating a web application for CRM to upload notes through it. But when I submit, it takes some time to perform the operation.
I am using a function to disable my page during this time period using following code in 'upload.aspx.cs' file. This code is working fine.
<style type="text/css">
.modal {
position: fixed;
top: 0;
left: 0;
background-color: black;
z-index: 99;
opacity: 0.8;
filter: alpha(opacity=80);
-moz-opacity: 0.8;
min-height: 100%;
width: 100%;
}
.loading {
font-family: Arial;
font-size: 10pt;
border: 5px solid #67CFF5;
width: 200px;
height: 100px;
display: none;
position: fixed;
background-color: White;
z-index: 999;
}
</style>
<script type="text/javascript" src="ajax.googleapis.com/.../jquery.min.js"></script>
<script type="text/javascript">
function myFunctionStart() {
ShowProgress();
}
function ShowProgress() {
setTimeout(function () {
var modal = $('<div />');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
</script>
<html>
<body>
<div class="loading" align="center">
<font color="black">Loading. Please wait...</font><br />
<br />
<img src="loader.gif" alt="" />
</div>
</body>
</html>
But it runs infinitely. Can anyone help me by giving a similar code to enable the page again?
Thanks in advance.
Arun Kumar
*This post is locked for comments
I have the same question (0)Hi,
This is because you are not hiding the popup once your work is done. You can use something that I am using. Below is the code:
HTML:
<div id="mask"></div>
<div id="divPopup"><h1>Please Wait..</h1></div>
CSS:
#mask {
display: none;
opacity: 0.8;
width: 100%;
height: 100%;
background: black;
z-index: 1;
position: absolute;
top: 0;
left: 0;
}
#divPopup {
width: 200px;
height: 65px;
background: white;
display: none;
top: 30%;
left: 38%;
z-index: 1;
position: absolute;
padding: 0 70px;
}
JS:
function showPopup()
{
$("#mask").css("display", "block");
$("#divPopup").css("display", "block");
}
function hidePopup()
{
$("#mask").css("display", "none");
$("#divPopup").css("display", "none");
}
You can call showPopup when you want to show the popup and call hide popup function when your work is done and you want to hide it.
Hope this helps.