[Support request] Setting the Hight & Width of an embeded iFrame

Home Forums Support [Support request] Setting the Hight & Width of an embeded iFrame

Home Forums Support Setting the Hight & Width of an embeded iFrame

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1518333
    Joe

    I’m using google word docs as embedded iframes on pages. I am unable to set the appropriate width and height of the iframes so they display properly on each page. I have added a link to one of the pages that shows how narrow each iframe is. I have tried modifying iframe size with css but no luck. how do I get the iframe to display properly and use the entire section instead of leaving so much white space on either side?

    #1518368
    Elvin
    Staff
    Customer Support

    Hi,

    Iframes are technically a separate webpage you display within your webpage. It’s like opening a browser window within your page. You can’t control how it displays by normal means.

    That said, custom script may work but I’m afraid that is out of GeneratePress’ scope of support.

    But, for the sake of helping you out, try this javascript:

    var iframe = document.getElementsByTagName('iframe')[0];
    iframe.addEventListener("load", function() {
        window.frames[0].document.body.style.width = '100%';
        window.frames[0].document.getElementById("contents").style.padding = '100px 0% 50px 0%; !important';
    });

    We’re basically styling the iframe when it loads using javascript here. I’m afraid it’s not guaranteed to work.

    You can add this script using Code Snippets btw.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.