Login
Membuat Animasi Loading/Proses Halaman Website

Membuat Animasi Loading/Proses Halaman Website

Cara membuat animasi loading/proses ketika membuka halaman suatu website cukup mudah, dan bisa membuat pengunjung website kita tidak boring ketika lama meload konten website kita :)


Example page.html

<html>
   <head>

     <!-- CSS -->
     <style>
       #preloader {
        position:fixed;
        top:0;
        left:0;
        right:0;
        bottom:0;
        background-color:#ffffff; /* change if the mask should have another color then white */
        z-index:99; /* makes sure it stays on top */
       }

       #status {
        width:200px;
        height:200px;
        position:absolute;
        left:50%; /* centers the loading animation horizontally one the screen */
        top:50%; /* centers the loading animation vertically one the screen */
        background-image:url(http://mediationbhc.gov.in/Pics/updateimg.gif); /* path to your loading animation */
        background-repeat:no-repeat;
        background-position:center;
        margin:-100px 0 0 -100px; /* is width and height divided by two */
       }
     </style>

   </head>
   <body>

     <!-- Loading -->
     <div id="preloader">
      <div id="status"></div>
     </div>
     
     <!-- Konten web -->
     <h1>Hello Word !</h1>

     <!-- jQuery -->
     <script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
     
     <!-- Javascript -->
     <script type="text/javascript">
      $(window).load(function() { // makes sure the whole site is loaded
      $("#status").fadeOut(); // will first fade out the loading animation
      $("#preloader").delay(350).fadeOut("slow"); // will fade out the white DIV that covers the website.
      })
     </script>

   </body>
</html>