code: function setDialogMaxSize() {
          var maxWidth, maxHeight,
              $dlgs = $(".modal-inner-wrapper > .instance");
  
          // Verify 1 or more modal dialogs are showing
          if ($dlgs.length > 0) {
              maxWidth  = $("body").width();
              maxHeight = $("body").height();
  
              $dlgs.css({
                  "max-width":  maxWidth,
                  "max-height": maxHeight,
                  "overflow":   "auto"
              });
          }
      }
docs: Don't allow dialog to exceed viewport size