JS代码动态生成遮罩层、蒙层
2021-04-11 18:26
标签:color top blog 遮罩层 article height idt block width JS代码动态生成遮罩层、蒙层 标签:color top blog 遮罩层 article height idt block width 原文地址:https://www.cnblogs.com/Oldz/p/12409178.html
//父层级设置显示样式
document.getElementById("maskDiv").style.display = ‘block‘;
//子节点设置样式var mask = document.createElement(‘div‘);
mask.id = ‘maskDiv‘;
mask.style.width = window.innerWidth +‘px‘;
mask.style.height = window.innerHeight +‘px‘;
mask.style.background = ‘#000000‘;
mask.style.opacity = ‘0.1‘;
mask.style.position = ‘absolute‘;
mask.style.display = ‘block‘; // 取消遮罩 设置为 none
mask.style.top = 30+‘px‘;
mask.style.zIndex = 999; // 设置元素层级
document.body.appendChild(mask);
// 原文链接:https://blog.csdn.net/shihongji/article/details/81118937
下一篇:jstack的使用