diff options
author | Scott González <scott.gonzalez@gmail.com> | 2010-02-06 02:02:03 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2010-02-06 02:02:03 +0000 |
commit | f2a9deb611332776e126cb847de4c5d577c413ef (patch) | |
tree | 3dc5148f54d80793784f01bbc4bf44680793a628 | |
parent | 267e9780c3fc156df189ac92a8d6ae055938768d (diff) | |
download | jquery-ui-f2a9deb611332776e126cb847de4c5d577c413ef.tar.gz jquery-ui-f2a9deb611332776e126cb847de4c5d577c413ef.zip |
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.
-rw-r--r-- | ui/jquery.ui.dialog.js | 9 |
1 files changed, 8 insertions, 1 deletions
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(); |