Solved

How to add loader animation to a page ?

Posted on 2016-11-11
2
22 Views
Last Modified: 2016-11-12
Hi Experts,

Am just curious about how to add Css or js animation loader to my page and how does it working and is there any tutorial on this

Thanks Experts
0
Comment
Question by:karthik80c
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 41883719
to write simple, you can have something like :
test page : https://jsfiddle.net/ueLkgju7/2/

<head>
  <style>
     .overlay {
         top:0;
         left:0;
         position:absolute;
         width:100%;
         height:100%;
         background-color:white;
     }
     .overlay img {
        display: block;
        margin-left: auto;
        margin-right: auto;
     }
  </style>
   <script>
          window.onload = function() {
              document.getElementById("hide_me_when_page_loaded").style.display = "none";
          }
  </script>
</head>
<body>
   <div class="overlay" id="hide_me_when_page_loaded"><img src="" /></div>
your page content follow
</body>

Open in new window


you've lot of tuto using Google search, for example : http://smallenvelop.com/display-loading-icon-page-loads-completely/
1
 
LVL 51

Assisted Solution

by:Julian Hansen
Julian Hansen earned 250 total points
ID: 41883755
Another sample
HTML
<body>
<div id="loader"></div>
...
</body>

Open in new window

CSS
<style type="text/css">
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.75) url(images/loading2.gif) no-repeat center center;
}
</style>

Open in new window

JavaScript
<script>
window.addEventListener('load', function() {
  var loader = document.getElementById('loader');
  loader.parentNode.removeChild(loader);
});
</script>

Open in new window

Working sample here

EDIT: remove() not supported everywhere updated to use parentNode.removeChild
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now