Advertisement
firoze

Preloader

May 3rd, 2015
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. // Preloader
  2.  
  3. // call this into your template
  4. <div id="preloader">
  5. <div id="status">&nbsp;</div>
  6. </div>
  7.  
  8. /*--------------------------------------------------------------------------------------------------*/
  9. // call this css into your css
  10.  
  11. /* Preloader */
  12.  
  13. #preloader {
  14. position:fixed;
  15. top:0;
  16. left:0;
  17. right:0;
  18. bottom:0;
  19. background-color:#fff; /* change if the mask should have another color then white */
  20. z-index:99; /* makes sure it stays on top */
  21. }
  22.  
  23. #status {
  24. width:200px;
  25. height:200px;
  26. position:absolute;
  27. left:50%; /* centers the loading animation horizontally one the screen */
  28. top:50%; /* centers the loading animation vertically one the screen */
  29. background-image:url(images/preloader.gif); /* path to your loading animation this is animation gif */
  30. background-repeat:no-repeat;
  31. background-position:center;
  32. margin:-100px 0 0 -100px; /* is width and height divided by two */
  33. }
  34.  
  35.  
  36. /*--------------------------------------------------------------------------------------------*/
  37.  
  38. // call this into your main.js
  39.  
  40. jQuery(document).ready(function() {
  41. jQuery(window).load(function() { // makes sure the whole site is loaded
  42. jQuery('#status').fadeOut(); // will first fade out the loading animation
  43. jQuery('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website.
  44. jQuery('body').delay(350).css({'overflow':'visible'});
  45. })
  46.  
  47. });
  48.  
  49. /*---------------------------------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement