jquery 遮罩层显示img
2021-07-04 09:07
标签:pointer tail src ext 设置 思路 item cli ref 如果点击iframe中的image显示整个页面的遮罩层,可参考如下: http://blog.csdn.net/shiaijuan1/article/details/70160714 具体思路就是,顶层添加dom对象,用来显示信息,默认隐藏,需要时在iframe中调用,宽高设置为100%。 实现如下: iframe中调用如下: jquery 遮罩层显示img 标签:pointer tail src ext 设置 思路 item cli ref 原文地址:http://www.cnblogs.com/lcawen/p/7120513.html //遮罩层
.showmask {
position: fixed;
z-index: 99;
width: 100%;
height: 100%;
background-color: silver;
top: 0px;
left: 0px;
opacity: 0.5;
}
.showmasklayer {
position: absolute;
z-index: 168;
top: 0px;
left: 0px;
min-width: 100%;
min-height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
//关闭按钮
.showmaskclose {
background-color: red;
color: white;
border: 2px solid gray;
position: fixed;
z-index: 288;
top: 0px;
right: 0px;
cursor: pointer;
height: 30px;
width: 30px;
font-size: large;
font-weight: bold;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
$(function () {
$("#image").on("click", function () {
//判断是否已经添加过遮罩层dom
if ($(".showmaskclose", window.top.document).length == 0) {
//附加遮罩层dom
$("body", window.top.document).append("