web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Hiding div using jquery in javascript function

(0) ShareShare
ReportReport
Posted on by

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)
  • Verified answer
    Community Member Profile Picture
    on at
    RE: Hiding div using jquery in javascript function

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans