[popup] Make sure the screen and the container have a higher z-index than any other element on the page

This commit is contained in:
Gabriel Schulhof 2011-12-20 14:00:24 +02:00
parent 051241484a
commit f60779518d
2 changed files with 18 additions and 4 deletions

View file

@ -1,7 +1,6 @@
.ui-popup-container {
display: inline-block;
position: absolute;
z-index: 100 !important;
padding: 0px;
}
@ -13,4 +12,4 @@
position:absolute;
top:-15px;
right:-15px;
}
}

View file

@ -204,8 +204,22 @@ $.widget("mobile.popup", $.mobile.widget, {
if (!this._isOpen) {
var self = this,
coords = this._placementCoords(
(undefined === x ? window.innerWidth / 2 : x),
(undefined === y ? window.innerWidth / 2 : y));
(undefined === x ? window.innerWidth / 2 : x),
(undefined === y ? window.innerHeight / 2 : y)),
zIndexMax = 0;
$(document)
.find("*")
.each(function() {
var el = $(this),
zIndex = parseInt(el.css("z-index"));
if (!(el.is(self._ui.container) || el.is(self._ui.screen) || isNaN(zIndex)))
zIndexMax = Math.max(zIndexMax, zIndex);
});
this._ui.screen.css("z-index", (zIndexMax + 1));
this._ui.container.css("z-index", (zIndexMax + 2));
this._ui.screen
.height($(document).height())
@ -244,6 +258,7 @@ $.widget("mobile.popup", $.mobile.widget, {
self._ui.screen.addClass("ui-screen-hidden");
self._isOpen = false;
self.element.trigger("closed");
self._ui.screen.removeAttr("style");
};
this._ui.container