javascript - Load iframe before other content -
javascript - Load iframe before other content -
i have iframe loading on page. content of iframe loads after rest of content has loaded on page. possible load content within iframe before rest of content on main page?
thanks
<iframe id="miiframe" src="http://www.apple.com"></iframe> <!-- illustration --> <div id="loading" style="position:fixed;background:red;width:100%;height:100%;top:0;left:0;z-index:2;"></div> <img id="background" style="position:absolute;width:100%;height:100%;top:0;left:0;z-index:-1;"/> <script> var loaded = false; console.log(loaded); function preloader(){ document.getelementbyid("loading").style.display = "none"; document.getelementbyid("miiframe").style.display = "block"; loaded = true; console.log(loaded); }//preloader var loadiframe = document.getelementbyid('miiframe'); loadiframe.onload = preloader; if(!loaded){ window.onload = function(){ background = document.getelementbyid("background"); background.src ="http://www.hdwallpapers.in/walls/cute_baby_in_autumn-wide.jpg"; }; } </script>
see jsfiddle
javascript jquery html iframe
Comments
Post a Comment