Advertisement
imranmodel32

Jquery pre loader on wp

Sep 4th, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. // preloader image
  2.  
  3. function wpb_preloader_image (){
  4. $wpb_preloader_gif_src = plugins_url( 'assets/images/preloader_3.gif' , __FILE__ );
  5. ?>
  6. <div class="wpb_preloader">
  7. <img src='<?php echo $wpb_preloader_gif_src; ?>' alt="" />
  8. </div>
  9. <?php
  10. }
  11. add_action('wp_footer','wpb_preloader_image');
  12.  
  13. // preloader script
  14.  
  15. function wpb_flat_preloader_trigger(){
  16. ?>
  17. <script>
  18. jQuery( window ).load(function() {
  19. jQuery(".wpb_preloader").fadeOut('slow');
  20. });
  21. </script>
  22. <?php
  23. }
  24. add_action('wp_footer','wpb_flat_preloader_trigger',999);
  25.  
  26. // preloader style
  27. function wpb_preloader_style (){
  28. ?>
  29. <style>
  30.  
  31. .wpb_preloader {
  32. background: none repeat scroll 0 0 #FFFFFF;
  33. height: 100%;
  34. left: 0;
  35. position: absolute;
  36. text-align: center;
  37. top: 0;
  38. width: 100%;
  39. z-index: 9999;
  40. }
  41. .wpb_preloader > img {
  42. margin-top: 20%;
  43. }
  44.  
  45. </style>
  46. <?php
  47. }
  48. add_action('wp_head','wpb_preloader_style');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement