jQuery – Display a loading icon until the page loads completely

Updated on     Kisan Patel

This tutorial will explain you how to display loading or processing gif image until the web page loads completely using jQuery?

So, first you need to add the below div element just after the body tag like this:

   <div id="loading">
        <img src="~/Content/Design/images/loader.gif" alt="Loading..." />

Here, I have used below css to align loader.gif image to center of the web page.

#loading {
   background-color: #fff;
   width: 100%;
   height: 100%;
   position: fixed;
   z-index: 999;

Now, use below jquery code to hide above div element after the page completely loaded.

<script type="text/javascript">
    jQuery(window).load(function () {


Leave a Reply