@@ -137,10 +137,12 @@ $.widget("ui.dialog", {
137137
138138 ( options . bgiframe && $ . fn . bgiframe && uiDialog . bgiframe ( ) ) ;
139139 ( options . autoOpen && this . open ( ) ) ;
140+
140141 } ,
141142
142143 destroy : function ( ) {
143144 ( this . overlay && this . overlay . destroy ( ) ) ;
145+ ( this . shadow && this . _destroyShadow ( ) ) ;
144146 this . uiDialog . hide ( ) ;
145147 this . element
146148 . unbind ( '.dialog' )
@@ -158,6 +160,7 @@ $.widget("ui.dialog", {
158160 }
159161
160162 ( this . overlay && this . overlay . destroy ( ) ) ;
163+ ( this . shadow && this . _destroyShadow ( ) ) ;
161164 this . uiDialog
162165 . hide ( this . options . hide )
163166 . unbind ( 'keypress.ui-dialog' ) ;
@@ -186,6 +189,7 @@ $.widget("ui.dialog", {
186189 maxZ = Math . max ( maxZ , parseInt ( $ ( this ) . css ( 'z-index' ) , 10 ) || options . zIndex ) ;
187190 } ) ;
188191 ( this . overlay && this . overlay . $el . css ( 'z-index' , ++ maxZ ) ) ;
192+ ( this . shadow && this . shadow . css ( 'z-index' , ++ maxZ ) ) ;
189193
190194 //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
191195 // http://ui.jquery.com/bugs/ticket/3193
@@ -240,6 +244,9 @@ $.widget("ui.dialog", {
240244 . filter ( ':first' )
241245 . focus ( ) ;
242246
247+ if ( options . shadow )
248+ this . _createShadow ( ) ;
249+
243250 this . _trigger ( 'open' ) ;
244251 this . _isOpen = true ;
245252 } ,
@@ -302,10 +309,12 @@ $.widget("ui.dialog", {
302309 } ,
303310 drag : function ( ) {
304311 ( options . drag && options . drag . apply ( self . element [ 0 ] , arguments ) ) ;
312+ self . _refreshShadow ( ) ;
305313 } ,
306314 stop : function ( ) {
307315 ( options . dragStop && options . dragStop . apply ( self . element [ 0 ] , arguments ) ) ;
308316 $ . ui . dialog . overlay . resize ( ) ;
317+ self . _refreshShadow ( ) ;
309318 }
310319 } ) ;
311320 } ,
@@ -331,11 +340,13 @@ $.widget("ui.dialog", {
331340 } ,
332341 resize : function ( ) {
333342 ( options . resize && options . resize . apply ( self . element [ 0 ] , arguments ) ) ;
343+ self . _refreshShadow ( ) ;
334344 } ,
335345 handles : resizeHandles ,
336346 stop : function ( ) {
337347 ( options . resizeStop && options . resizeStop . apply ( self . element [ 0 ] , arguments ) ) ;
338348 $ . ui . dialog . overlay . resize ( ) ;
349+ self . _refreshShadow ( ) ;
339350 }
340351 } )
341352 . find ( '.ui-resizable-se' ) . addClass ( 'ui-icon ui-icon-grip-diagonal-se' ) ;
@@ -466,7 +477,29 @@ $.widget("ui.dialog", {
466477 ? 'auto'
467478 : options . height - nonContentHeight
468479 } ) ;
480+ } ,
481+
482+ _createShadow : function ( ) {
483+ this . shadow = $ ( '<div class="ui-widget-shadow"></div>' ) . css ( 'position' , 'absolute' ) . appendTo ( document . body ) ;
484+ this . _refreshShadow ( ) ;
485+ return this . shadow ;
486+ } ,
487+
488+ _refreshShadow : function ( ) {
489+ var offset = this . uiDialog . offset ( ) ;
490+ this . shadow . css ( {
491+ left : offset . left ,
492+ top : offset . top ,
493+ width : this . uiDialog . outerWidth ( ) ,
494+ height : this . uiDialog . outerHeight ( )
495+ } ) ;
496+ } ,
497+
498+ _destroyShadow : function ( ) {
499+ this . shadow . remove ( ) ;
500+ this . shadow = null ;
469501 }
502+
470503} ) ;
471504
472505$ . extend ( $ . ui . dialog , {
@@ -482,9 +515,9 @@ $.extend($.ui.dialog, {
482515 minHeight : 150 ,
483516 minWidth : 150 ,
484517 modal : false ,
485- overlay : { } ,
486518 position : 'center' ,
487519 resizable : true ,
520+ shadow : true ,
488521 stack : true ,
489522 title : '' ,
490523 width : 300 ,
@@ -547,12 +580,10 @@ $.extend($.ui.dialog.overlay, {
547580 }
548581
549582 var $el = $ ( '<div></div>' ) . appendTo ( document . body )
550- . addClass ( 'ui-dialog-overlay' ) . css ( $ . extend ( {
551- borderWidth : 0 , margin : 0 , padding : 0 ,
552- position : 'absolute' , top : 0 , left : 0 ,
583+ . addClass ( 'ui-widget-overlay' ) . css ( {
553584 width : this . width ( ) ,
554585 height : this . height ( )
555- } , dialog . options . overlay ) ) ;
586+ } ) ;
556587
557588 ( dialog . options . bgiframe && $ . fn . bgiframe && $el . bgiframe ( ) ) ;
558589
0 commit comments