Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!