javascript - 一个对象溢出,而另一个对象覆盖 css 反应
问题描述
https://i.stack.imgur.com/QR8gn.jpg
如图所示,主体对象是重叠覆盖对象在我网站的主页中,我制作了一个覆盖对象。单击它时,主页及其所有元素将显示为黑色,但是当我在主页中制作了一个滑块并添加了一些关于该图像的描述时,该描述与我的那个覆盖对象重叠。您可以在图像中看到更多说明。
<div className="showCoachInfo">
<div onClick={toggle1} className="overlayCoach"></div>
<div className="infoDet">
<img src={coach1} className="infoImg" />
<p>Anbhol Singh</p>
<p>NIS Coach</p>
<p>National Medalist</p>
</div>
</div>
.infoDet{
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
background: #000000;
color: white;
border-radius: 10px;
height: 300px;
width: 300px;
transition: all 0.5s ease-in;
font-size: 20px;
text-align: center;
font-family: 'Mate SC', serif;
z-index: 10000;
}
.showCoachInfo,.overlayCoach{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
}
现在重叠的对象
<div
key={index}
className={index === activeIndex ? "slides activeS" : "inactiveS"}
>
<img src={slide.urls} alt="" className="slide-image" />
<h3 className="slide-desc"> {slide.description} </h3>
{/* <h3 className="slide-desc"> {slide.title} </h3> */}
</div>
.slide-desc{
background-color: black;
opacity: 0.7;
margin-left: 100px;
width: 84.05%;
height: 10%;
color: white;
font-size: 41px;
position: absolute;
text-align: center;
top: 84.5%;
z-index: 10;
font-family: 'Mate SC', serif;
border-radius: 0px 0px 10px 10px;
}
解决方案
推荐阅读
- c++ - pugixml - 迭代特定节点
- python - 如何在我的代码中检查 pytorch 中每一层的输出梯度?
- sql - 将结果插入到更新列的表中
- c# - 程序无法读取以 0.xxx 开头的十进制数
- python - 如何伪造丢失的间隔记录?
- java - 使用策略设计模式和@Autowired 将 Bean 实例设为 null
- python - DJango 不执行 request.method == "post" 与 ajax 数据提交
- oauth-2.0 - 如何发现不透明访问令牌的颁发者?
- javascript - 无法以角度读取 Object.onClick 处的 null 属性“值”
- bash - Bash脚本在启动时不执行