Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to show the image during the page load,
like the below website
http://mahindrareva.com/
Posted
Comments
Sinisa Hajnal 20-May-15 2:39am    
Search for Page load progress bar. You'll get tons of examples, plugins and even whole projects on github

1 solution

A simple jQuery should be able to do this job:

Take the image that you want to show as loading image and name it as loaderImage.gif and update the source in the below div tag and then add the following code just after the body tag of your page:

XML
<div id="loading">
  <img id="loading-image" src="images/loaderImage.gif" alt="Loading..." />
</div>


Add CSS for the loader image::
CSS
#loading {
   width: 100%;
   height: 100%;
   top: 0px;
   left: 0px;
   position: fixed;
   display: block;
   opacity: 0.7;
   background-color: #fff;
   z-index: 99;
   text-align: center;
}

#loading-image {
  position: absolute;
  top: 100px;
  left: 240px;
  z-index: 100;
}


Add the following java script preferably, before you close the body tag:
XML
<script language="javascript" type="text/javascript">
     $(window).load(function() {
     $('#loading').hide();
  });
</script>


You can adject the CSS to meet your requirements
 
Share this answer
 
Comments
venkatesh@India 20-May-15 3:13am    
without using body tag.how can get this
Abhipal Singh 20-May-15 4:32am    
I just checked the source of http://mahindrareva.com/ website. It does have a body tag which you can use to implement the above.

Is there something which is hindering you, to not to use that block.
venkatesh@India 20-May-15 9:46am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900