943,852 Members | Top Members by Rank

Ad:
Jun 23rd, 2009
0

Show loading Animation before iframe is fully loaded

Expand Post »
Hi to all, I have the following situation:
I have an iframe and I want to display a loading animation to the user until the iframe is fully loaded, this is want I did:
1. I start the iframe with style:display:none
2. I have a div that wraps the iframe
3. When the iframe is fully loaded a method is called from the iframe 'removeDivs', I change the div to be invisble with style:display:none and I set the iframe to be visible with stle:display:""
4. The problem: Because the div wraps the iframe, after changing the style of the iframe its stay invisible, the property I set doesn't affect.
Thanks in advanced
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <style>
  4. .loading-indicator {
  5. font-size:8pt;
  6. background-image:url(../images/loading/loading.gif);
  7. background-repeat: no-repeat;
  8. background-position:top left;
  9. padding-left:20px;
  10. height:18px;
  11. text-align:left;
  12. }
  13. #loading{
  14. position:absolute;
  15. left:45%;
  16. top:40%;
  17. border:3px solid #B2D0F7;
  18. background:white url(../images/loading/block-bg.gif) repeat-x;
  19. padding:10px;
  20. font:bold 14px verdana,tahoma,helvetica;
  21. color:#003366;
  22. width:180px;
  23. text-align:center;
  24. }
  25. </style>
  26.  
  27. <script>
  28. function removeDivs()
  29. {
  30. document.getElementById('loading').style.display="none";
  31. document.getElementById('MyIframe').style.display="";
  32. }
  33. </script>
  34. </head>
  35. <body>
  36. <div id="loading">
  37. <div class="loading-indicator">
  38. Page Loading...
  39. <iframe id="MyIframe" src="flash.html" width="500" height="500" style="display:none"></iframe>
  40. </div>
  41. </div>
  42. </body>
  43. </html>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Potato.Head is offline Offline
32 posts
since Dec 2008
Jun 23rd, 2009
0

Re: Show loading Animation before iframe is fully loaded

I am not really good with css but I think you should !important in your css. when you put !important tag in css that property does not overwriten by surrounding tags here is page
http://webdesign.about.com/od/css/f/blcssfaqimportn.htm
(just google it there should be some tutorials about that.)
I hope that helps
Reputation Points: 31
Solved Threads: 5
Light Poster
yilmazhuseyin is offline Offline
48 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Smooth scrolling required
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: How to remove underline and blue color from text in html?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC