问题描述
当我单击3行标签时,我想查看我的导航列表。 但是当我单击它时什么也没发生。 请让我知道该怎么做。 TT 这是我写的代码。
当我单击3行标签时,我想查看我的导航列表。 但是当我单击它时什么也没发生。 请让我知道该怎么做。 TT 这是我写的代码。
随着页面缩小,出现三行标签。 而我使用的是Google chrome。
const burger = document.querySelector(".burger");
const navLinks = document.querySelector(".nav-links");
const links = document.querySelectorAll(".nav-links li");
burger.addEventListener("click",() => {
navLinks.classList.toggle("open");
});
*{
margin: 0px;
padding: 0px;
Box-sizing: border-Box;
}
body{
font-family: sans-serif;
}
nav{
height: 10vh;
background: black;
}
.nav-links{
display: flex;
list-style: none;
width: 50%;
height: 100%;
justify-content: space-around;
align-items: center;
margin-left: auto;
}
.nav-links li a{
color: white;
text-decoration: none;
font-size: 16px;
}
.landing{
height: 90vh;
display: flex;
justify-content: center;
align-items: center;
}
.landing h1{
margin: 100px;
font-size: 50px;
color: purple;
}
@media screen and (max-width: 768px){
.line {
width: 30px;
height: 3px;
background: white;
margin: 5px;
}
nav{
position: relative;
}
.burger{
position: absolute;
cursor: pointer;
right: 5%;
top: 50%;
transform: translate(-5%,-50%);
}
.nav-links{
position: fixed;
background: black;
height: 100vh;
width: 100%;
flex-direction: column;
clip-path: circle(100px at 90% -20%);
-webkit-clip-path: circle(100px at 90% -20%);
transition: all 1s ease-out;
}
.nav-links.open{
clip-path: circle(1000px at 90% -20%);
-webkit-clip-path: circle(1000px at 90% -20%);
}
.landing{
flex-direction: column;
}
}
<!DOCTYPE html>
<html>
<head>
<Meta charset="utf-8">
<Meta name="viewport" content="width=device-width,initial-scale=1.0">
<Meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link href="https://fonts.googleapis.com/css2?family=Alata&display=swap" rel="stylesheet">
<title>FRIENDS</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<nav>
<div class="burger">
<div class="line"></div>
<div class="line"></div>
<div class="line"></div>
</div>
<ul class="nav-links">
<li><a href="#">HOME</a></li>
<li><a href="#">CHaraCTER</a></li>
<li><a href="#">STUDY</a></li>
<li><a href="#">VISITORS</a></li>
</ul>
</nav>
<section class="landing">
<img src="circle.png" alt="dots">
<h1>FRIENDS<h1>
</section>
<script type="app.js"></script>
</body>
</html>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)