Javascript 打开多模态对话框的问题
我有用于打开模态对话框的自定义代码(类似于库) 它看起来像下面Javascript 打开多模态对话框的问题,javascript,jquery,twitter-bootstrap,dialog,modal-dialog,Javascript,Jquery,Twitter Bootstrap,Dialog,Modal Dialog,我有用于打开模态对话框的自定义代码(类似于库) 它看起来像下面 _initRenderModal : function(template, templateData, options){ var me = this; // Default Options me.modalOptions = { backdrop : 'static', keyboard : true, width : 900,
_initRenderModal : function(template, templateData, options){
var me = this;
// Default Options
me.modalOptions = {
backdrop : 'static',
keyboard : true,
width : 900,
show : true,
autoFocus : true
};
var id = $(template).prop("id");
me.configureModal();
var $backdrop = $(".modal-backdrop:not([forModal])").attr("forModal", id);
this.modalId = id;
},
hideModal : function(){
$(".modal[id='"+this.modalId+"']").modal("hide");
$(".modal-backdrop[formodal='"+this.modalId+"']").remove();
},
removeModal : function(event){
for(var i in this.destroyItems) {
var item = this.destroyItems[i];
if($.isFunction(this.destroyItems[i].destroy)) {
this.destroyItems[i].destroy();
}
delete item;
}
this.destroyItems = [];
this.hideModal();
this.removeView();
this.remove();
}
此外,我正在使用Bootstrap 2.3.2作为模式对话框
我的问题是,虽然我的自定义代码对于单个打开的模式对话框工作正常,但当我试图同时打开两个模式对话框时,它会产生问题
(即从父模式中打开子模式)
这些问题主要与UI上的背景有关;
我的意思是我的子模式稍微小一些,当我打开子模式时,我可以访问父模式(当打开子对话框时,我应该不能访问父模式)
请建议我如何在上面的代码中修复以处理多个打开模式对话框。您可以做一些事情来解决这个问题。1扩展引导中的模态,使其具有lock属性,并在打开子模态时锁定父模态。2确保在打开子模式时引用父模式,并应用一些css更改子模式背景的z索引。这将向您演示如何执行1。