Loading Image concept in salesforce

Where you can use this in salesforce??
When you have rerender some another fields based on picklist value change.

Add following line of code to your css file


#loading-image {
position: fixed;
top: 40%;
left: 50%;
}
#loading {
width: 100%;
height: 100%;
top: 0px;
left: 0px;
position: absolute;
display: none;
opacity: 0.5;
filter: alpha(opacity = 50);
-moz-opacity: 0.5;
background-color: #fff;
text-align: center;
z-index: 100;
}

Add following line of code to your JS file


//function for showing loading image
function showLoadingImage() {
document.getElementById('loading').style.display='block';
}


//function for hiding loading image
function hideLoadingImage() {
document.getElementById('loading').style.display='none';
}

Add following line of code anywhere on your page



Loading...

Now Call showLoadingImage() method through events i.e onclick or onchange and Call hideLoadingImage() method through events i.e oncomplete

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply