【发布时间】:2017-12-14 22:06:19
【问题描述】:
我有 SVG 波浪和一个圆圈。我需要从 SVG 内部隐藏圆圈。
我在 SVG 波形上设置了 z-index: -3;,在圆圈上设置了z-index:-1,在 div 上设置了z-index: 10;。
当用户滚动时,我必须从 SVG 内部隐藏那个圆圈。请查看我的第二张图片。由于 z-index,圆圈位于 wave 和示例 div 之间。
我无法正确解释。希望你能理解我的问题。
你能帮我解决这个问题吗?
body {
margin: 0;
padding: 0;
}
.parent_div {
height: 600px;
width: 100%;
}
.about_wave_1 {
position: relative;
top: 0;
margin-top: 300px;
}
.about_wave {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(-180deg);
transform: rotate(180deg);
position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
z-index: -3;
}
.ewSzGA path {
fill: #00a2ff;
}
.bg_blue {
background-color: #00a2ff;
text-align: center;
height: 200px;
}
.service-container {
border-radius: 10px;
position: fixed;
z-index: -1;
right: 0;
top: 30px;
opacity: 1;
}
.service_1 {
width: 200px;
height: 200px;
border-radius: 50%;
display: flex;
background-color: #EFBD40;
position: absolute;
right: 205px;
top: 0;
}
.service-container .service_1 h2 {
margin: auto;
color: #fff;
font-size: 28px;
}
.example {
background-color: #ff0000;
height: 300px;
width: 100%;
border: 1px solid #000;
z-index: 10;
}
<div class="parent_div">
<div class="service-container">
<div class="service_1 logo_bg">
<h2>text</h2>
</div>
</div>
<div class="about_wave_1">
<div class="about_wave">
<svg height="50" viewBox="0 0 1440 50" xmlns="http://www.w3.org/2000/svg" class="sc-gqjmRU ewSzGA" data-reactid="208"><path d="M0 39.5062C144.0016 39.5062 144.0016 0 288.0032 0c143.9936 0 143.9936 39.5062 287.9873 39.5062C719.9842 39.5062 719.9842 0 863.9858 0s144.0016 39.5062 288.0032 39.5062C1295.9905 39.5062 1295.9905 0 1440 0v50H0V39.5062z" data-reactid="209"></path>
</svg>
</div>
</div>
<div class="example"></div>
</div>
【问题讨论】:
-
这样可以吗?
-
试试我的代码,希望对您的问题有所帮助
-
其实是的。试试我的代码,你会发现它是可能的 :) @NarendraVerma