最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

js彈出div并顯示遮罩層

 更新時(shí)間:2014年02月12日 09:49:38   作者:  
彈出div顯示遮罩層的效果,想必大家都有見(jiàn)到過(guò)吧,下面有個(gè)示例,大家可以參考下
復(fù)制代碼 代碼如下:

//--------------------彈出層-------------------
//popDivId:彈出層div的ID
//dragDivId:用于拖動(dòng)div的ID
//isShowMask:是否顯示遮罩層
function popDivShow(popDivId, dragDivId, isShowMask) {
if (isShowMask) {
creatMask(popDivId);
}
var oWins = document.getElementById(popDivId);
var oWins_title = document.getElementById(dragDivId);
var bDrag = false;
var disX = disY = 0;
oWins.style.display = "block";
oWins_title.onmousedown = function(event) {
var event = event || window.event;
bDrag = true;
disX = event.clientX - oWins.offsetLeft;
disY = event.clientY - oWins.offsetTop;
this.setCapture && this.setCapture();
return false;
};
document.onmousemove = function(event) {
if (!bDrag)
return;
var event = event || window.event;
var iL = event.clientX - disX;
var iT = event.clientY - disY;
var maxL = document.documentElement.clientWidth - oWins.offsetWidth;
var maxT = document.documentElement.clientHeight - oWins.offsetHeight;
iL = iL < 0 ? 0 : iL;
iL = iL > maxL ? maxL : iL;
iT = iT < 0 ? 0 : iT;
iT = iT > maxT ? maxT : iT;
oWins.style.marginTop = oWins.style.marginLeft = 0;
oWins.style.left = iL + "px";
oWins.style.top = iT + "px";
return false;
};
document.onmouseup = window.onblur = oWins_title.onlosecapture = function() {
bDrag = false;
oWins_title.releaseCapture && oWins_title.releaseCapture();
};
}
// 隱藏彈出層
function popDivHidden(popDivId) {
var oWins = document.getElementById(popDivId);
oWins.style.display = "none";
window.parent.document.body.removeChild(window.parent.document.getElementById("maskDiv"));
}
// 獲取彈出層的zIndex
function getZindex(popDivId) {
var popDiv = document.getElementById(popDivId);
var popDivZindex = popDiv.style.zIndex;
return popDivZindex;

}
// 創(chuàng)建遮罩層
function creatMask(popDivId) {
// 參數(shù)w為彈出頁(yè)面的寬度,參數(shù)h為彈出頁(yè)面的高度,參數(shù)s為彈出頁(yè)面的路徑
var maskDiv = window.parent.document.createElement("div");
maskDiv.id = "maskDiv";
maskDiv.style.position = "fixed";
maskDiv.style.top = "0";
maskDiv.style.left = "0";
maskDiv.style.zIndex = getZindex(popDivId) - 1;
maskDiv.style.backgroundColor = "#333";
maskDiv.style.filter = "alpha(opacity=70)";
maskDiv.style.opacity = "0.7";
maskDiv.style.width = "100%";
maskDiv.style.height = (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"));
};
}

相關(guān)文章

最新評(píng)論

广宗县| 宽城| 清新县| 图木舒克市| 左贡县| 鲁山县| 温州市| 弥勒县| 洛浦县| 永泰县| 新闻| 农安县| 绩溪县| 桃江县| 赤水市| 榕江县| 尉犁县| 惠来县| 板桥市| 特克斯县| 繁昌县| 土默特右旗| 当雄县| 凤山县| 上栗县| 革吉县| 利辛县| 新源县| 子长县| 伊通| 页游| 榆林市| 霍林郭勒市| 县级市| 荥经县| 佛坪县| 壤塘县| 利川市| 黄陵县| 新田县| 阿坝县|