Created
December 10, 2011 11:24
-
-
Save jmav/1454952 to your computer and use it in GitHub Desktop.
Resize jQuery UI dialog to window size if init dialog size is larger then window size.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment