自定义弹出框实现过程01

$(document).ready(function() {
	$('#popupContact').Drags({
	  handler: '#widgetBoxTopId',                
	  zIndex:200,
	  opacity:.9
    });
	
});
var popupStatus = 0;

//加载弹出窗体
function loadPopup(){
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.05"
		});
		$("#backgroundPopup").fadeIn("fast",function(){
			$("#popupContact").fadeIn("fast",function(){
				var obj=$("#widgetBoxMidId tr:visible :text,#widgetBoxMidId tr:visible :button");
				if(obj!=null&&obj!=undefined&&obj.length>=1){
					obj.get(0).focus();
				}
			});	
		});
		popupStatus = 1;
	}
}

//关闭弹出窗体
function closePopup(){
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("fast");
		$("#popupContact").fadeOut("fast");
		$("#widgetBoxMidId").html("");
		popupStatus = 0;
	}
}

//设置窗体的弹出位置
function centerPopup(){
	//request data for centering
	var windowWidth = document.body.clientWidth;
	var windowHeight = document.body.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	$("#backgroundPopup").css({
		"height": windowHeight,
		"width":windowWidth
	});
}
//调用弹出窗体事件
function popupDivWindow(popupTitle,width,height){
	$("#popupContact").css("width",width); //设置窗体的宽度
	$("#popupWindowTitle").html(popupTitle);//设置窗体的标题
	$("#widgetBoxMidId").css("height",height);//设置窗体的高度
	$("#popupDivWindow_iframe").css("height",parseInt(height.replace("px",""))+50);
	centerPopup();
	loadPopup();
}
/*
function popupDivDrag(obj){ 
     var s = obj.style; 
     var b = document.body;  
  var x = event.clientX + b.scrollLeft - s.pixelLeft;  
  var y = event.clientY + b.scrollTop - s.pixelTop;
   
  var m = function(){ 
   if(event.button == 1){ 
    s.pixelLeft = event.clientX + b.scrollLeft - x;  
    s.pixelTop = event.clientY + b.scrollTop - y;  
   }else {
    document.detachEvent("onmousemove", m);
   } 
  } 
 document.attachEvent("onmousemove", m) 
 
  if(!this.z)
   this.z = 999;  
  s.zIndex = ++this.z;  
  event.cancelBubble = true;  
 }*/  


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值