White flash iframe

I have a left navigation bar in my iFrame with two elements switching between two pages. Sometimes there is a white flash, sometimes it is not.

Some of the methods I've tried so far are:

<iframe style="visibility:hidden;" onload="this.style.visibility = 'visible';"> 

Not a trick.

 jQuery('#jobs-frame').load(function(){ $(this).show(); }); jQuery('#primary a').click(function(){ //alert('hello'); jQuery('#jobs-frame').hide(); }); 

And did not do the trick. Any other method I tried turned out to be deprecated. I was puzzled that these two solutions have a lot of comments / reviews that say they work, but in Chrome - the only browser I have tested so far - I still have this problem.

+4
source share
3 answers

If you want to avoid the โ€œwhite flashโ€, do not follow the links to HTML pages, but put both pages in 2 <div> and switch between them (this also allows quite animation).

0
source

I had a similar problem with iframes that were dynamically generated. In Chrome, switching the visibility removed the white flash, but it still flickers. In Safari, switching the display actually introduced an associated iframe fix error.

What ended for me was switching opacity :

 <iframe style="opacity: 0;" onload="this.style.opacity = 1;">` 
0
source

just type style="background-color: #000000;" in html tag

-1
source

Source: https://habr.com/ru/post/1443522/


All Articles