Skip to content

Instantly share code, notes, and snippets.

@jmav
Created December 10, 2011 11:24
Show Gist options
  • Save jmav/1454952 to your computer and use it in GitHub Desktop.
Save jmav/1454952 to your computer and use it in GitHub Desktop.

Revisions

  1. jmav created this gist Dec 10, 2011.
    24 changes: 24 additions & 0 deletions jQuery UI max size
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    (function ($) {
    var _init = $.ui.dialog.prototype._init;

    //Custom Dialog Init
    $.ui.dialog.prototype._init = function () {
    var self = this;

    // set max size of dialog
    var offSet = 20;
    var wWidth = $(window).width() - offSet;
    var wHeight = $(window).height() - offSet;
    if(self.options.height > wHeight ){
    self.options.height = wHeight ;
    self.options.maxHeight = wHeight ;
    };
    if(self.options.width >= wWidth){
    self.options.width = wWidth ;
    self.options.maxWidth = wWidth ;
    };

    _init.apply(this, arguments);

    };
    })(jQuery);