【发布时间】:2021-05-28 19:19:46
【问题描述】:
你能帮我解决这个问题吗?我尝试了其他问题的提示,但不幸的是没有帮助。我想根据不同部分的背景颜色更改自定义汉堡菜单的颜色(具有悬停效果)。这是我的 HTML 和 CSS:
https://jsfiddle.net/s4gh8cw9/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Test</title>
</head>
<style>
.section {
width: 100%;
height: 450px;
background-color: white;
}
.section-black {
width: 100%;
height: 450px;
background-color: black;
}
.special-con {
cursor: pointer;
display: inline-block;
}
.bar {
display: block;
height: 2px;
width: 20px;
background: #000000;
margin: 5px auto;
}
.col {
display: inline-block;
width: 24%;
text-align: center;
height: auto;
position: fixed;
}
.bar {
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
transition: all .4s ease;
}
.con:hover .arrow-top-fall {
-webkit-transform: translateY(-5px);
-moz-transform: translateY(-5px);
-ms-transform: translateY(-5px);
-o-transform: translateY(-5px);
transform: translateY(-5px);
}
.con:hover .arrow-bottom-fall {
-webkit-transform: translateY(5px);
-moz-transform: translateY(5px);
-ms-transform: translateY(5px);
-o-transform: translateY(5px);
transform: translateY(5px);
}
.special-con {
margin: 0 auto;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
transition: all .4s ease;
}
.special-con:hover .arrow-top-fall {
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
-ms-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
-webkit-transform: translateY(-5px);
-moz-transform: translateY(-5px);
-ms-transform: translateY(-5px);
-o-transform: translateY(-5px);
transform: translateY(-5px);
}
.arrow-bottom-fall,
.arrow-top-fall {
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
-ms-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.special-con:hover .arrow-bottom-fall {
-webkit-transform: translateY(5px);
-moz-transform: translateY(5px);
-ms-transform: translateY(5px);
-o-transform: translateY(5px);
transform: translateY(5px);
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
-ms-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
</style>
<body>
<div class="section">
<div class="col">
<div class="special-con">
<a href="#elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6IjE0MDYiLCJ0b2dnbGUiOmZhbHNlfQ%3D%3D">
<div class="bar arrow-top-fall"></div>
<div class="bar arrow-middle-fall"></div>
<div class="bar arrow-bottom-fall"></div>
</a>
</div>
</div>
</div>
<div class="section-black">
</div>
<div class="section">
</div>
<div class="section-black">
</div>
<div class="section">
</div>
<div class="section-black">
</div>
<div class="section">
</div>
</body>
</html>
非常感谢!
【问题讨论】:
标签: javascript html jquery css scroll