So I'm kind of stuck and I'm looking to see if anyone could give me some assistance, so I have the following jQuery code:
let VimeoBlock = function($element) {
function init() {
adjustPositioning();
}
function adjustPositioning() {
const classList = $element.attr('class');
if (classList.indexOf('alignwide') > -1) {
const vimeo_iframe = $element.find('iframe');
console.log(vimeo_iframe);
}
}
return {
init: init,
}
}
$(document).ready(function () {
$('.wp-block-embed-vimeo').each(function (i, ele) {
(new VimeoBlock($(ele))).init();
});
});
console.log(vimeo_iframe); outputs the following items when I can access the iFrame index with its properties:
I'm able to target the iFrame, but I want to be able to target the parent class inside the iFrame - How would I go about doing this and appending CSS to that class?
Since you cannot do this for the styling of the iframe if it's on a different origin, there is no solution in this case. However, if it was the same domain or an iframe with an inner structure, then you could do it like this:
document.getElementById("youriframeid").contentDocument.querySelector("yourselector").style.display = 'none';
Note that I have used dummy selectors and a dummy styling, you can use yours instead.