Code Snippet
Get Rid of White Flash when iframe Loads
Hides iframe until fully loaded.
<iframe style="visibility:hidden;" onload="this.style.visibility = 'visible';" src="../examples/inlineframes1.html" > </iframe>
Much more robust and progressive method here.
wow, cool
Exactly what I needed! Didn’t know this was possible.
Thankee Jesus!!!!
thank YOU!!!!
Why doesn’t it work for me? I have 3 pages with iframes: archive, current and black white series
When I look in IE 7 or 8 the white box still flashes… ???
Your code will keep the iframe hidden if javascript is disabled. This one will only hide/show the frame if javascript is enabled.
//iframe flashes white bugfix with jquery
//set visibility to ‘hidden’ in the actual page
$(“iframe”).load(function() {
$(this).css(“visibility”, “visible”);
});
$(“iframe”).ready(function() {
$(this).css(“visibility”, “hidden”);
});
Hi,
Is there any chance you could tell me how/where would I integrate this in Facybox?
Many thanks
works fine !! thx a lot – greetings from austria – jodeldijodeldiö
Any W3C valid solution?
Love you. Thats just simple genius
It does work, however it works only once. After the iFrame-constructed page loads, if you click on a link that it’s supposed to load another page on said iFrame, and because said iFrame is already loaded and hence visible, the white Flash is back.
struggles with this problem in fancybox for ages,
go to the fancy box jacked.js
look for first occurance of “<iframe"
change to:
wont let me post full html:
id=”fancybox-frame” name=”fancybox-frame’+(new Date).getTime()+’” frameborder=”0″ hspace=”0″ allowtransparency=”true” style=”visibility:hidden;” onload=”this.style.visibility = \’visible\’;” scrolling=”‘+e.scrolling+’” src=”‘+d.href+’”
You need to do 3 things really:
make iframe invisible, in css “visible:hidden”
make iframe allow transparency, allowtransparency=”true”
make the body it displays have a transparent background, “background-color:transparent”
Thank you so much! This works very well! It’s ridiculous how Internet Explorer 9 STILL shows a white background for iframes during page load! Unbelievable.
Here I find another good solution that is working:
http://swsharinginfo.blogspot.com/2011/11/avoid-iframe-white-flash-issue-while.html
thx. so easy…
Thanks a million. I wasted hours trying to figure this out. A simple solution that works.
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.