我刚刚开始学习J-Query,我正在尝试在我的网页中实现一个简单的点击事件,当你点击一个按钮时它将打开mobile-nav.
当我选择标题时,此按钮有效,例如它会隐藏标题,但不会显示mobile-nav?
ps我正在复制DICE主页仅用于学习目的,因为我知道我正在使用受版权保护的媒体;).
我认为这可能与我隐藏移动导航在我CSS所以J-query无法toogle /显示它.
@media screen and (max-width: 1024px) {
nav{
justify-content: space-around;
}
.bars{
display:block;
width: 50px;
height: 100px;
cursor: pointer;
}
ul{
display: none !important;
}
.mobile-nav{
display: none;
position:absolute;
z-index: 3;
left:-110px;
top:70px;
width: 100%;
height: 100%;
opacity: 0.8;
background-color:black;
}
.mobile-nav li{
height: 50px;
}
.mobile-nav a{
font-size: 2rem;
font-weight: 700;
}
}Run Code Online (Sandbox Code Playgroud)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Dice</title>
<meta name="description" content="">
<meta name="author" …Run Code Online (Sandbox Code Playgroud)