var uiDialogContainer = uiDialogContent.parent().addClass('ui-dialog-container').css({position: 'relative'});\r
var uiDialog = (this.uiDialog = uiDialogContainer.parent()).hide()\r
.addClass('ui-dialog').addClass(options.dialogClass)\r
- .css({position: 'absolute', width: options.width, height: options.height, overflow: 'hidden'}); \r
+ .css({\r
+ position: 'absolute',\r
+ width: options.width,\r
+ height: options.height,\r
+ overflow: 'hidden',\r
+ zIndex: options.zIndex\r
+ });\r
\r
var classNames = uiDialogContent.attr('className').split(' ');\r
\r
uiDialog.draggable({\r
handle: '.ui-dialog-titlebar',\r
start: function(e, ui) {\r
- self.activate();\r
+ self.moveToTop();\r
(options.dragStart && options.dragStart.apply(this, arguments));\r
},\r
drag: options.drag,\r
}\r
\r
uiDialog.mousedown(function() {\r
- self.activate();\r
- });\r
- uiDialogTitlebar.click(function() {\r
- self.activate();\r
+ self.moveToTop();\r
});\r
\r
(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());\r
this.position(this.options.position);\r
this.uiDialog.show();\r
this.moveToTop();\r
- this.activate();\r
\r
// CALLBACK: open\r
var openEV = null;\r
this.uiDialogTitlebarClose.focus();\r
this.element.triggerHandler("dialogopen", [openEV, openUI], this.options.open);\r
},\r
-\r
- activate: function() {\r
- // Move modeless dialogs to the top when they're activated. Even\r
- // if there is a modal dialog in the window, the modeless dialog\r
- // should be on top because it must have been opened after the modal\r
- // dialog. Modal dialogs don't get moved to the top because that\r
- // would make any modeless dialogs that it spawned unusable until\r
- // the modal dialog is closed.\r
- (!this.options.modal && this.moveToTop());\r
- },\r
- \r
+ \r
moveToTop: function() {\r
+ if (this.options.modal || !this.options.stack) { return; }\r
+ \r
var maxZ = this.options.zIndex, options = this.options;\r
$('.ui-dialog:visible').each(function() {\r
maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);\r
(this.overlay && this.overlay.$el.css('z-index', ++maxZ));\r
this.uiDialog.css('z-index', ++maxZ);\r
},\r
- \r
+ \r
close: function() {\r
(this.overlay && this.overlay.destroy());\r
this.uiDialog.hide();\r
overlay: {},\r
position: 'center',\r
resizable: true,\r
+ stack: true,\r
width: 300,\r
zIndex: 1000\r
},\r