$(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;
}*/
自定义弹出框实现过程01
最新推荐文章于 2022-11-15 22:19:55 发布