Skip to content

Instantly share code, notes, and snippets.

@lichspace
Created December 26, 2019 07:24
Show Gist options
  • Save lichspace/00bb7b8db9e9797f012dbd24eb6783a5 to your computer and use it in GitHub Desktop.
Save lichspace/00bb7b8db9e9797f012dbd24eb6783a5 to your computer and use it in GitHub Desktop.
一种点击其他区域隐藏当前元素的方案
//.context-menu形成透明层,点击。触发。mymenu消失
.context-menu{
.hidden-mask{
position: fixed;
left: 0;
top:0;
width: 100%;
height: 100%;
z-index: 1;
}
.mymenu{
width: 150px;
z-index: 2;
position: absolute;
background: #777777;
border-radius: 3px;
border-color: #000;
color: #D9D9D9;
line-height: 1.6;
li{
list-style: none;
padding: 5px 10px;
border-bottom: var(--primary);
&:hover{
background: #ef9c1a;
color: #fff;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment