js隐藏div

更新时间:2023-04-17 22:47:22 阅读: 评论:0


2023年4月17日发(作者:金鱼花怎么养)JS +DIV+CSS弹出层并且后面有遮盖效果(首先要应用Jquery
//获得当前页面高度
function GetPageHeight()
{
if ($.)
{
return Mode == "CSS1Compat" ?
Height :
Height;
}
el
{
return eight;
}
}
//获得当前页面宽度
function GetPageWidth()
{
if ($.)
{
return Mode == "CSS1Compat" ?
Width :
Width;
}
el
{
return idth;
}
}
//显示遮盖层
function ShowCoverDiv()
{
//如果遮盖孙悟空的故事 层已经存在,就删除它
$("#coverdiv").remove(); 淀粉怎么用
//设置BODY的样式(可选)
$("body").css({ "position":
"absolute" ,"margin-top":"0px","margin-left":"0px"});
//创建出遮54年属什么 盖层
$("body").append高中生综合素质自我评价怎么写 ("
");

//设置遮盖层的样式
$("#coverdiv").css({ "display": "none", "left": "0px", "top": "0px",
"position": "absolute", "z-index": "5", "background-color": "#777", "width":

GetPageWidth(), "height": GetPageHeight(), "filter": "alpha(opacity=60)" });

}
//显示弹出层(参数为要显示的Div内部的Html内容)
function ShowPopDiv(innerHtml)
{
//调用遮盖方法
ShowCoverDiv();
//创建弹出DIV
$("body").append("
");

创意开学 //接受传进来的HTML标签
if (innerHtml != null)
{
$(innerHtml).css({ "display": "block" });
$(innerHtml).appendTo("#TextDiv");
}
//设置弹出层在弹出情况下的位置(居中)
var margintop = (GetPageHeight() -
mentById("TextDiv").offtHeight) / 2;
var marginleft = (GetPageWidth() -
mentById("TextDiv").offtWidth) / 2;
$("#TextDiv").css({ "display": "none", "position": "absolute", "z-index": "9",
"top": margintop, "left": marginleft });
/饺子象征着什么 /neo海军 渐渐显示出消息层
$("#coverdiv").show("slow");
$("#TextDiv").show("slow");
$("#TextDiv").draggable(); //拖动
//当页面大小改变,那么弹出层会始终居中,遮盖层的大小也随之改变
ze = function()
{
if (mentById("coverdiv") != null &&
mentById("TextDiv") != null)
$("#coverdiv").css({ "width": GetPageWidth(), "height":
GetPageHeight() });
if (mentById("TextDiv") != null)
荷花壁纸高清图片 {
var margintop = (GetPageHeight() -
mentById("TextDiv").offtHeight) / 2;
var marginleft = (GetPageWidth() -

mentById("TextDiv洋葱牛肉饼 ").offtWidth) / 2;
$("#TextDiv").css({ "top": margintop, "left": marginleft });
}
}
}
//隐藏遮盖层和弹出层
function cloDiv()
{
$("#coverdiv").hide("slow");
$("#TextDiv").hide("slow");
}


本文发布于:2023-04-17 22:47:22,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/501448.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:js隐藏div
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图