Skip to content

Instantly share code, notes, and snippets.

@stevenfollis
Created August 20, 2014 15:39
Show Gist options
  • Save stevenfollis/0343b45a40818976c14b to your computer and use it in GitHub Desktop.
Save stevenfollis/0343b45a40818976c14b to your computer and use it in GitHub Desktop.
SP2013 Resize AppPart iFrames from host page with jQuery
// select and loop through all iframes inside of webparts
$('.ms-WPBody iframe').each(function(i, frame) {
// define a variable to hold the new width
var newWidth;
// starting with the iframe, search up the DOM for the closest webpart zone
// then find its width and store it
newWidth = $(frame).closest('.ms-webpart-zone').width();
// set the iframe to the new width
$(frame).width(newWidth);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment