다음과 같이 코드 코드를 복사하십시오.
// -----------------------------------------------
// popdivid : 레이어 div의 ID
// dragdivid : div의 ID를 드래그하는 데 사용됩니다.
// isshowmask : 마스크 레이어가 표시되는지 여부
기능 popdivshow (popdivid, dragdivid, isshowmask) {
if (isshowmask) {
Creatmask (Popdivid);
}
var wont = document.getElementById (popdivid);
var Own_tital = document.getElementById (dragdivid);
var bdrag = false;
var disx = disy = 0;
owins.style.display = "블록";
owins_tital.onmousedown = function (event) {{
var Every = 이벤트 || 이벤트;
bdrag = true;
Disx = event.clientx -owins.offsetLect;
disy = event.clienty -owins.offsetTop;
this.setcapture && s.setcapture ();
거짓을 반환합니다.
};
document.onmouseMove = function (이벤트) {
if (! bdrag)
반품;
var Every = 이벤트 || 이벤트;
var il = event.clientx -disx;
var it = event.clienty -disy;
var maxl = document.documentedlement.clientWidth -owins.OffSetWidth;
var maxt = document.documentedlement.clientHeight -owins.offSetheight;
il = il <0 : il;
il = il> maxl : il;
It = It it <0? 0 : It;
It = It> Maxt : It;
owins.style.margintop = owins.style.marginleft = 0;
owins.style.left = il + "px";
owins.style.top = it + "px";
거짓을 반환합니다.
};
document.onmouseup = window.onblur = owins_title.onlosecapture = function () {
bdrag = false;
owins_tital.releasecapture && pins_title.releasecapture ();
};
}
// POP -UP 레이어를 숨 깁니다
기능 popdivhidden (popdivid) {{
var wont = document.getElementById (popdivid);
owins.style.display = "none";
Window.parent.document.body.removeChild (Window.parent.document.getElementById ( "MaskDiv")
}
// POP -UP 레이어 Zindex를 가져옵니다
함수 getzindex (popdivid) {
varpodiv = document.getElementById (popdivid);
varpodivzindex = popdiv.style.zindex;
PopdivzIndex를 반환합니다.
}
// 마스크 레이어를 만듭니다
기능 Creatmask (Popdivid) {{
// 매개 변수 w는 POP -UP 페이지의 너비이고, 매개 변수 h는 POP -UP 페이지의 높이이고, 매개 변수 S는 POP -UP 페이지의 경로입니다.
var maskdiv = window.parent.document.createElement ( "div");
maskdiv.id = "maskdiv";
maskdiv.style.position = "고정";
maskdiv.style.top = "0";
maskdiv.style.left = "0";
maskdiv.style.zindex = getzindex (popdivid) -1;
maskdiv.style.backgroundcolor = "#333";
maskdiv.style.filter = "알파 (불투명도 = 70)";
maskdiv.style.opacity = "0.7";
maskdiv.style.width = "100%";
maskdiv.style.head = (window.parent.document.body.scrollheight + 50) + "px";
Window.parent.document.body.appendChild (MaskDiv);
maskdiv.onmousedown = function () {
Window.parent.document.body.removeChild (Window.parent.document.getElementById ( "MaskDiv")
};
}