lhgdialog常见问题

1.弹出多个窗口时,让最后弹出的窗口始终保持在最上层。

解决方式一:添加parent属性。

$.dialog({  
		title : "标题", 
		id :"detailDialog",
		parent : this,
		width : 300,  
		height : 400,  
		lock : true,
		zIndex:zIndex,     
		content : 'url:' + "${contextPath}/sys/car/enterWriteCarMsg",    
	}); 

在parent属性无效的情况下,采用第二种方式。

解决方式二:每次打开dialog都重新计算zIndex。

var windowapi = frameElement == null ? window.top:frameElement.api, 
	var W = windowapi == null ? window.top : windowapi.opener;//内容页中调用窗口实例对象接口  
	var zIndex = W == null?1976 : W.$.dialog.setting.zIndex+1;  
	$.dialog({  
		title : "标题", 
		id :"detailDialog",
		width : 300,  
		height : 400,  
		lock : true,
		zIndex:zIndex,     
		content : 'url:' + "${contextPath}/sys/car/enterWriteCarMsg",    
	});

2.打开多个弹窗,在关闭上层弹窗时,下层弹窗的遮罩消失。

如:先打开A弹窗,在A弹窗再打开B弹窗,当B弹窗关闭时,A弹窗的遮罩层消失

解决方法:一般情况下,在打开B弹窗的dialog里面添加parent属性即可。

但在某些情况下不行,需要在打开B弹窗的close回调方法里面添加如下代码:

$.dialog({
		id:'test',
		title:'B弹窗',
		content:"url:${ctx}/people/peopleDetail",
		lock:true,
		width:'400px',
		height:'300px',
		close:function(){
			setTimeout(function(){
				var windowapi = frameElememt == null ? window.top : frameElement.api;
				windowapi.lock();
			},100);
		}
	});


猜你喜欢

转载自blog.csdn.net/xukongjing1/article/details/79635964