I have a iframe placed into a script editor.

When the height of the iframe is set to 100% the images all size correctly but the script editor web part does not.

IFrame Height

How can I get the editor to mach the size of the content inside it?

EDIT: This will resize the iframe to take half of the window size on load. A few tweaks are needed to correct it.

<script type="text/javascript">
        function resize_iframe()
            var height=window.innerWidth;//Firefox
            if (document.body.clientHeight)
            //Resize the iframe according to the size of the
            //window (all these should be on the same line)
        // This will resize the iframe every
        // time you change the size of the window.

You can add the following javascript code to your master page. It let you manually resize the web parts in edit mode:

$(function() {
        handles: 'all', 
        autoHide: true

See this article for more information

| improve this answer | |
  • I have tried adding this but will need to find the correct ID as I cant see 'WebPartWPQ' in the HTML. – James Michael Lucas Jan 29 '16 at 11:23
  • @JamesMichaelLucas I tried this on our own Sharepoint. In edit mode the correct id is: WebPartTitleWPQ7 – Citizen SP Jan 29 '16 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.