您好,当我在内容之外单击时,我无法关闭模式,我想使用CSS执行此操作。但是它不起作用,我走了,向您展示代码,也许有人可以帮助我。.
.overlay{
height: 100vh;
width: 100%;
position: fixed;
top:0;
left: 0;
background-color: rgba(50, 65, 97, 0.5);
z-index: 9999;
opacity: 0;
visibility: hidden;
transition: all .3s;
}
.overlay .cancel {
position: absolute;
width: 100%;
height: 100%;
cursor: default;
}
.overlay__content {
position: absolute;
top: 44%;
left: 55.5%;
padding:4rem 9.5rem;
width: 540px;
background-color: $color-white;
box-shadow: 0 2rem 4rem rgba($color-primary, .2);
border-radius: 3px;
display: table;
overflow: hidden;
opacity: 0;
transform: translate(-50%, -50%) scale(.25);
transition: all .4s .2s;
}
.overlay:target {
opacity: 1;
visibility: visible;
}
.overlay:target .overlay__content {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
<a href="#modal1" class="add-roles-btn">My Modal</a>
<div class="overlay" id="modal1">
<a class="cancel" href="#_"></a>
<div class="overlay__content">
something
</div>
</div>
如果有人可以帮助我,我会很感激,因为我是编码方面的新手,对此我困扰了很长时间。:/
答案 0 :(得分:1)
只需删除_
+ set(CMAKE_PREFIX_PATH_bak ${CMAKE_PREFIX_PATH})
+ set(CMAKE_PREFIX_PATH "/usr/local")
find_package(PythonInterp)
+ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH_bak})
并将其更改为
<a class="cancel" href="#_"></a>
<a class="cancel" href="#"></a>
.overlay{
height: 100vh;
width: 100%;
position: fixed;
top:0;
left: 0;
background-color: rgba(50, 65, 97, 0.5);
z-index: 9999;
opacity: 0;
visibility: hidden;
transition: all .3s;
}
.overlay .cancel {
position: absolute;
width: 100%;
height: 100%;
cursor: default;
}
.overlay__content {
position: absolute;
top: 44%;
left: 55.5%;
padding:4rem 9.5rem;
width: 540px;
background-color: $color-white;
box-shadow: 0 2rem 4rem rgba($color-primary, .2);
border-radius: 3px;
display: table;
overflow: hidden;
opacity: 0;
transform: translate(-50%, -50%) scale(.25);
transition: all .4s .2s;
}
.overlay:target {
opacity: 1;
visibility: visible;
}
.overlay:target .overlay__content {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
答案 1 :(得分:0)
您的代码似乎运行正常。尝试点击以下代码段中的红色。我认为您只需要更改模态的背景颜色,以便在模态内部单击时以及模态外部单击时知道。
UiTheme
UserManager