Company News

Dynamically Resize SharePoint Modal Dialogs

April 22, 2016

My colleague Alec and I ran into an issue today where SharePoint was having difficulty rendering modal dialogs at the correct size. The dialogs were too small for the content they contained, and therefore some undesired scroll bars appeared. Nobody wants that!

Thanks to Chad Schroeder’s post for a nifty little fix:

function resizeDLG() {
    var dlg = SP.UI.ModalDialog.get_childDialog();
    if (dlg != null) {

setTimeout(resizeDLG, 500);

Add that to your Master Page and tweak as necessary for your purposes, and when SharePoint loads a page as a dialog it should size itself properly.

2 Responses

  1. Serena says:

    Thank you very much!

    I was experiencing the very same bug on my Company’s sharepoint2013 and this script worked like a charm.

  2. Ashok says:

    Brilliant code fix, thanks a lot for this, I was struggling from a long time.

Leave a Reply

Matt Longpre

Matt Longpre

Subscribe via Email


Powered by...

itgroove Corporate Profile
Connect With Us
%d bloggers like this: