gpt4 book ai didi

固定位置弹出窗口的CSS关闭按钮

转载 作者:太空宇宙 更新时间:2023-11-04 08:04:35 25 4
gpt4 key购买 nike

我正在尝试创建一个用 JQuery 触发并用 CSS 设置样式的弹出窗口。我在框的右上角添加了一个关闭按钮,但是当您在框内向下滚动时(溢出:滚动,由于框的最大高度)X 关闭按钮也会滚动,即使定义了绝对位置:

.team-name-popup{
position:fixed;
z-index: 9;
top:10%;
left:50%;
margin-left:-350px;
width:700px;
height:auto;
max-height:400px;
background:rgba(0,0,0,0.9);
overflow:scroll;
}
.team-name-popup-inner{
position:relative;
width:100%;
height:auto;
max-height: 100%;
padding: 50px;
overflow:scroll;
}
.team-popup-close{
position:absolute;
z-index:999;
top:5px;
right:10px;
color:#fff;
}

HTML

<div class="team-name-popup">
<a href="#" class="team-popup-close">&times;</a>
<div class="team-name-popup-inner">
<h5 class="team-name">Name</h5>
Text here
</div><!--team popup inner-->
</div><!--team popup-->

我尝试更改溢出,但滚动不起作用:

.team-name-popup{
....
overflow:hidden;
}
.team-name-popup-inner{
....
overflow:scroll;
}

默认

enter image description here

滚动

enter image description here

最佳答案

请检查此解决方案。

.team-name-popup{
position:fixed;
z-index: 9;
top:10%;
left:50%;
margin-left:-350px;
width:700px;
height: 400px;
max-height:400px;
background:rgba(0,0,0,0.9);
overflow:scroll;
}
.team-name-popup-inner{
position: absolute;
width:100%;
height: 400px;
padding: 50px;
overflow:scroll;
}
.team-popup-close{
position:absolute;
z-index:999;
top:5px;
right:10px;
color:#fff;
}

关于固定位置弹出窗口的CSS关闭按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46752864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com