In the web application, the loading overlay effect is very useful when part of the page content is loaded dynamically from the backend. Generally, a loading GIF image with an overlay background is displayed over the HTML element while fetching content from the backend. Assume that a data list is displayed on the web page with pagination links. When the pagination links are clicked another list of data is displayed. To fetch data from the backend script, the server takes some time and the user does not understand what happening behind the scene. So, if you display a loading image over the content list, it will be helpful for the user to understand the data loading process.
In this tutorial, we’ll provide a short code snippet to create an overlay element and display a preloader over the content div using CSS. Not only for the list content, but you can also use it for every case where you want to add an overlay effect on the content and display loading animation.
HTML Code:
Create an HTML element to contain the overlay wrapper with a loading image.
.overlay
element.<div class="content">
<!-- Loader element -->
<div class="overlay">
<div class="overlay-content"><img src="images/loader.gif" alt="Loading..."/></div>
</div>
<!-- Page content goes here -->
</div>
CSS Code:
Define CSS code to apply styles to the overlay background and loading image over HTML element.
.content{
position: relative;
}
.overlay{
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
z-index: 2;
background-color: rgba(255,255,255,0.8);
}
.overlay-content {
position: absolute;
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
top: 50%;
left: 0;
right: 0;
text-align: center;
color: #555;
}
Do you want to get implementation help, or enhance the functionality of this script? Click here to Submit Service Request
Thanks for this tutorial.
Can you provide such a tutorial like when page is loading, Before complete loading this overlay will display then after this overlay will hide
@Aamir The overlay preloader script is used in this tutorial, please check it from here – http://www.codexworld.com/pagination-with-jquery-ajax-php-mysql/
Hello. Thanks For this.
Can you make another version of this?
When The button is click
Then the PreLoader will show
.Please