]> source.dussan.org Git - jquery-ui.git/commitdiff
Dialog: Prevent the titlebar from displaying above the top of the document.
authorScott González <scott.gonzalez@gmail.com>
Sat, 6 Feb 2010 02:02:03 +0000 (02:02 +0000)
committerScott González <scott.gonzalez@gmail.com>
Sat, 6 Feb 2010 02:02:03 +0000 (02:02 +0000)
Fixes #5141 - Position of Dialog is off the page when viewport is smaller then dialog.

ui/jquery.ui.dialog.js

index a6111b8729b2883f6586637eb5659a3115831738..aba6f50b73105c0c4dc98f0e4ff029d8c4a4c16f 100644 (file)
@@ -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();