@@ -454,10 +454,15 @@ $.widget( "ui.dialog", {
454
454
that . _trigger ( "drag" , event , filteredUi ( ui ) ) ;
455
455
} ,
456
456
stop : function ( event , ui ) {
457
- options . position = [
458
- ui . position . left - that . document . scrollLeft ( ) ,
459
- ui . position . top - that . document . scrollTop ( )
460
- ] ;
457
+ var left = ui . offset . left - that . document . scrollLeft ( ) ,
458
+ top = ui . offset . top - that . document . scrollTop ( ) ;
459
+
460
+ options . position = {
461
+ my : "left top" ,
462
+ at : "left" + ( left >= 0 ? "+" : "" ) + left + " " +
463
+ "top" + ( top >= 0 ? "+" : "" ) + top ,
464
+ of : that . window
465
+ } ;
461
466
$ ( this ) . removeClass ( "ui-dialog-dragging" ) ;
462
467
that . _unblockFrames ( ) ;
463
468
that . _trigger ( "dragStop" , event , filteredUi ( ui ) ) ;
@@ -503,8 +508,18 @@ $.widget( "ui.dialog", {
503
508
that . _trigger ( "resize" , event , filteredUi ( ui ) ) ;
504
509
} ,
505
510
stop : function ( event , ui ) {
506
- options . height = $ ( this ) . height ( ) ;
507
- options . width = $ ( this ) . width ( ) ;
511
+ var offset = that . uiDialog . offset ( ) ,
512
+ left = offset . left - that . document . scrollLeft ( ) ,
513
+ top = offset . top - that . document . scrollTop ( ) ;
514
+
515
+ options . height = that . uiDialog . height ( ) ;
516
+ options . width = that . uiDialog . width ( ) ;
517
+ options . position = {
518
+ my : "left top" ,
519
+ at : "left" + ( left >= 0 ? "+" : "" ) + left + " " +
520
+ "top" + ( top >= 0 ? "+" : "" ) + top ,
521
+ of : that . window
522
+ } ;
508
523
$ ( this ) . removeClass ( "ui-dialog-resizing" ) ;
509
524
that . _unblockFrames ( ) ;
510
525
that . _trigger ( "resizeStop" , event , filteredUi ( ui ) ) ;
0 commit comments