From f2a9deb611332776e126cb847de4c5d577c413ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 6 Feb 2010 02:02:03 +0000 Subject: [PATCH] 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. --- ui/jquery.ui.dialog.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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(); -- 2.39.5