From: Scott González Date: Sat, 6 Feb 2010 02:02:03 +0000 (+0000) Subject: Dialog: Prevent the titlebar from displaying above the top of the document. X-Git-Tag: 1.8rc2~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f2a9deb611332776e126cb847de4c5d577c413ef;p=jquery-ui.git Dialog: Prevent the titlebar from displaying above the top of the document. Fixes #5141 - Position of Dialog is off the page when viewport is smaller then dialog. --- diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index a6111b872..aba6f50b7 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -445,7 +445,14 @@ $.widget("ui.dialog", { at: myAt.join(' '), offset: offset.join(' '), of: window, - collision: 'fit' + collision: 'fit', + // ensure that the titlebar is never outside the document + using: function(pos) { + var topOffset = $(this).css(pos).offset().top; + if (topOffset < 0) { + $(this).css('top', pos.top - topOffset); + } + } }); if (!isVisible) { this.uiDialog.hide();