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.
This commit is contained in:
Scott González 2010-02-06 02:02:03 +00:00
parent 267e9780c3
commit f2a9deb611

View File

@ -445,7 +445,14 @@ $.widget("ui.dialog", {
at: myAt.join(' '), at: myAt.join(' '),
offset: offset.join(' '), offset: offset.join(' '),
of: window, 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) { if (!isVisible) {
this.uiDialog.hide(); this.uiDialog.hide();