* WoltLab Community Framework core methods
*/
$.extend(WCF, {
+ /**
+ * count of active dialogs
+ * @var integer
+ */
+ activeDialogs: 0,
+
/**
* Counter for dynamic element id's
*
// create modal view
if (this.options.modal) {
- this._overlay = $('<div class="wcf-dialogOverlay"></div>').css({ height: '100%', zIndex: 900 }).appendTo(document.body);
-
+ this._overlay = $('#jsWcfDialogOverlay');
+ if (!this._overlay.length) {
+ this._overlay = $('<div id="jsWcfDialogOverlay" class="wcf-dialogOverlay"></div>').css({ height: '100%', zIndex: 900 }).appendTo(document.body);
+ }
+
if (this.options.closable) {
this._overlay.click($.proxy(this.close, this));
}
if (this._overlay !== null) {
- this._overlay.show();
+ WCF.activeDialogs++;
+
+ if (WCF.activeDialogs === 1) {
+ this._overlay.show();
+ }
}
this.render();
this._container.wcfFadeOut();
if (this._overlay !== null) {
- this._overlay.hide();
+ WCF.activeDialogs--;
+
+ if (WCF.activeDialogs === 0) {
+ this._overlay.hide();
+ }
}
if (this.options.onClose !== null) {