Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
Append styling to a iFrame #document element

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:

enter image description here

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?

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda