Modality¶
-
class
webix.
Modality
()¶ Modality mixin
External references¶
Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | webix.Modality = {
_modal_set:function(value){
if (value){
if (!this._modal_cover){
this._modal_cover = webix.html.create('div',{
"class":"webix_modal"
});
/* with below code we will have the same zIndex for modal layer as for the previous
abs positioned element, but because of attaching order modal layer will be on top anyway
*/
var zIndex = this._settings.zIndex||webix.ui.zIndex();
//set topmost modal layer
this._previous_modality = webix._modality;
webix._modality = zIndex;
this._modal_cover.style.zIndex = zIndex-1;
this._viewobj.style.zIndex = zIndex;
document.body.appendChild(this._modal_cover);
webix._event( this._modal_cover, "click", webix.bind(this._ignore_clicks, this));
}
}
else {
if (this._modal_cover){
webix.html.remove(this._modal_cover);
//restore topmost modal layer
//set delay, as current window closing may have not finished click event
//need to wait while it is not fully processed
var topmost = this._previous_modality;
setTimeout(function(){ webix._modality = topmost; }, 1);
this._modal_cover = null;
}
}
return value;
}
};
|