I'd like to preface this with I am very new to JS and HTML so if this is an ignorant question or my terminology is terrible, I apologize. Also this is my first time posting on StackOverflow, so I'm hoping that I'm using their code embedding correctly, elsewise this post may be frightening to look at.
I have a Tableau Viz that I am embedding into a **Wix **website. It embeds properly, but I would like to drill down from into a #shadow-root into #document to update a CSS attribute and make the viz background transparent.
The element for the CSS attribute is:
<div id="dashboard-spacer" class="dashboardSpacer tab-widget" role="application" style="width: 1000px; height: 573px; background-color: rgb(255, 255, 255); visibility: visible; margin: auto;">
Which is contained within #document Which is contained within #shadow-root (some attributes removed as it is very large)
<iframe title="Data Visualization" allowtransparency="true" allowfullscreen="true" id="tableau-viz" name="tableau-viz" src="sensitive_info_pointing_to_my_dashboard"></iframe>
Which is within (this is the only HTML part that I actually add manually. The rest is all a result of the src in tableau-viz) And I would like to update background-color to transparent
I've been able to access/log the shadow-root with jQuery with:
$(document).ready(function() {
let testvar = document.querySelector('#tableau-viz').shadowRoot;
console.log(testvar)
});
Which only logs the iframe element, not the document attached (no idea if this is the expected result) but haven't gotten much further than that. I tried the following from what little I know about JS, but my guess is this is buggy nonsense:
let spacer = document.querySelector('#tableau-viz').shadowRoot.querySelector('#dashboard-spacer');
spacer.attr("background-color", 'transparent')
(This also may all just violate cross-origin policies, as the website is wix and the iframes are tableau?)
Thanks everyone! It'll be super cool if we can figure this out!