Stefan
Stefan

Reputation: 155

White flash when opening iframe Colorbox

I get an white flash when opening an iframe colorbox. How can I prevend the iframe to first show the white background and then the supposed iframe?

Upvotes: 2

Views: 1540

Answers (2)

uɥƃnɐʌuop
uɥƃnɐʌuop

Reputation: 15113

The white flash is the result of colorbox dynamically generating the iframe. While the iframe is loading you see the background color of the colorbox window itself.

One way to solve this issue is to use the "black" colorbox css styles as demonstrated in this jsfiddle. You can find this colorbox.css file in the "Example 3" folder when you download colorbox. Using this style you will of course see a black flash rather than and white flash, but it blends in better with the translucent black of the colorbox overlay.

Alternatively you can customize the colorbox.css file that's best suited to your needs. There's 5 prebuilt styles, which you can see demonstrated at the official colorbox site.

Upvotes: 0

Derek Hunziker
Derek Hunziker

Reputation: 13141

Try passing fastIframe: false in the colorbox configuration. It makes colorbox wait until all contents of the iframe are loaded before attempting to show anything.

$('a').colorbox({ iframe: true, fastIframe: false });

Upvotes: 2

Related Questions