Advertisement
hubert17

Display a GIF During IFRAME Loading [jQuery]

Sep 29th, 2014
449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.04 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jQuery Demo - IFRAME Loader</title>
  5. <style>
  6. #frameWrap {
  7.     position:relative;
  8.     height: 360px;
  9.     width: 640px;
  10.     border: 1px solid #777777;
  11.     background:#f0f0f0;
  12.     box-shadow:0px 0px 10px #777777;
  13. }
  14.  
  15. #iframe1 {
  16.     height: 360px;
  17.     width: 640px;
  18.     margin:0;
  19.     padding:0;
  20.     border:0;
  21. }
  22.  
  23. #loader1 {
  24.     position:absolute;
  25.     left:40%;
  26.     top:35%;
  27.     border-radius:20px;
  28.     padding:25px;
  29.     border:1px solid #777777;
  30.     background:#ffffff;
  31.     box-shadow:0px 0px 10px #777777;
  32. }
  33. </style>
  34.  
  35. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  36. </head>
  37. <body>
  38.  
  39. <div id="frameWrap">
  40. <img id="loader1" src="loading.gif" width="36" height="36" alt="loading gif"/>
  41. <iframe id="iframe1" src="targetPage.html" ></iframe>
  42. </div>
  43. <script>
  44.     $(document).ready(function () {
  45.         $('#iframe1').on('load', function () {
  46.             $('#loader1').hide();
  47.         });
  48.     });
  49. </script>
  50.  
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement