How To Change Iframe Background Color In Wordpress
6 Answers 6
An <iframe>
background tin can be inverse similar this:
<iframe allowtransparency="true" style="background: #FFFFFF;" src="http://zingaya.com/widget/9d043c064dc241068881f045f9d8c151" frameborder="0" height="184" width="100%"> </iframe>
I don't recall it'south possible to change the background of the folio that you lot take loaded in the iframe.
ashleedawg
18.4k 7 gold badges 65 argent badges 93 statuary badges
answered February 12, 2013 at ten:59
KingkKingk
927 8 silver badges thirteen bronze badges
1
JavaScript is what y'all demand. If you are loading iframe when loading the page, insert the test for iframe using the onload consequence. If iframe is inserted in realtime, then create a callback function on insertion and claw in whatever activeness y'all demand to have :)
answered Feb 12, 2013 at fourteen:07
AngelaAngela
1,064 one gold badge xi silver badges 23 bronze badges
1
-
information technology would be dainty, if could provide the code (I'm not proficient in Java Script)
Feb thirteen, 2013 at 4:23
You can do it using javascript
- Change iframe background color
- Change background color of the loaded folio (same domain)
Plain javascript
var iframe = certificate.getElementsByTagName('iframe')[0]; iframe.style.groundwork = 'white'; iframe.contentWindow.document.body.style.backgroundColor = 'white';
jQuery
$('iframe').css('groundwork', 'white'); $('iframe').contents().discover('body').css('backgroundColor', 'white');
answered May 27, 2018 at 5:09
ChetabahanaChetabahana
8,722 3 gold badges 57 silver badges 72 bronze badges
0
just building on what Chetabahana wrote, I constitute that adding a short delay to the JS function helped on a site I was working on. It meant that the function kicked in afterwards the iframe loaded. Y'all can play effectually with the delay.
var delayInMilliseconds = 500; // half a 2nd setTimeout(function() { var iframe = document.getElementsByTagName('iframe')[0]; iframe.style.background = 'white'; iframe.contentWindow.certificate.torso.style.backgroundColor = 'white'; }, delayInMilliseconds);
I promise this helps!
answered April 24, 2019 at 14:33
J CoxJ Cox
31 2 bronze badges
0
answered Aug xviii, 2020 at 15:43
ganjeiiganjeii
one,069 1 gold badge xiv silver badges 26 bronze badges
Put the Iframe between aside tags
<aside style="background-color:#FFF"> your IFRAME </aside>
Robert
5,221 43 gold badges 62 silverish badges 113 statuary badges
answered February 10, 2016 at nine:41
ane
-
Might desire to explain how putting an iframe in an aside will change its background color
Aug 17, 2018 at 3:14
Not the answer y'all're looking for? Browse other questions tagged html iframe groundwork-color or ask your own question.
Source: https://stackoverflow.com/questions/14830852/change-background-color-of-iframe-issue
Posted by: henrypeargen.blogspot.com
I desire to modify the background of loaded page
February 12, 2013 at 11:01