• 카테고리

    질문 & 답변
  • 세부 분야

    웹 개발

  • 해결 여부

    미해결

모바일 메뉴가 안나옵니다

20.12.22 13:56 작성 조회수 102

1

index.html

<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- page scroll effects JS & CSS -->
<script src="js/jquery-2.1.4.js"></script>
<script src="js/velocity/velocity.min.js"></script>
<script src="js/velocity/velocity.ui.min.js"></script>
<script src="js/velocity/main.js"></script>
<link rel="stylesheet" href="js/velocity/velocity.css">
<!-- Smooth Scrolling -->
<script src="js/jquery.scrollTo.min.js"></script>
<!-- custom js & css -->
<script src="custom.js"></script>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="responsive.css">
<title>DesignWorks Architecture Agency</title>
</head>
<body data-hijacking="on" data-animation="rotate">
<div class="container">
<section class="cd-section visible" id="home">
<div>
<div class="content">
<img src="images/temp-section-01.jpg" alt="">
</div>
</div>
</section>
<section class="cd-section" id="about">
<div>
<div class="content">
<h2>Section 2</h2>
</div>
</div>
</section>
<section class="cd-section" id="project">
<div>
<div class="content">
<h2>Section 3</h2>
</div>
</div>
</section>
<section class="cd-section" id="awards">
<div>
<div class="content">
<h2>Section 4</h2>
</div>
</div>
</section>
<section class="cd-section" id="Location">
<div>
<div class="content">
<h2>Section 5</h2>
</div>
</div>
</section>
<section class="cd-section" id="contact">
<div>
<div class="content">
<h2>Section 6</h2>
</div>
</div>
</section>
<section class="cd-section">
<div>
<div class="content">
<h2>Section 7</h2>
</div>
</div>
</section>
<header>
<div class="gnb-inner">
<div class="logo">
<a href="#none"><img src="images/logo.png" alt="로고"></a>
</div>
<div class="gnb">
<div class="menu">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#project">Project</a>
<a href="#plan">Plan & History</a>
<a href="#awards">Awards</a>
<a href="#location">Location</a>
<a href="#contact">Contact</a>
</div>
<div class="slogan">We design places, not projects.</div>
</div>
<div class="trigger">
<span></span>
<span></span>
<span></span>
</div>
</div>
</header>
</div>
<nav>
<ul class="cd-vertical-nav">
<li><a href="#0" class="cd-prev inactive">Next</a></li>
<li><a href="#0" class="cd-next">Prev</a></li>
</ul>
</nav>
</body>
</html>

style.css

/* Google Web Font : Montserrat */
@import url("https://fonts.googleapis.com/css?family=Montserrat:200,300,400,500&display=swap");
@import url("https://fonts.googleapis.com/css?family=Manrope:300,400,500,600&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@200;300;400;600;700;900&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Overpass&display=swap");

/* FontAwesome CDN 4.7 */
@import url("https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");

/* RESET CSS */
* {
box-sizing: border-box;
}
ul {
list-style: none;
}
a {
text-decoration: none;
}

/* Default CSS */
body {
font-family: "Montserrat", sans-serif;
color: #222;
font-size: 15px;
margin: 0;
height: 100vh;
background-color: #fff;
}
/* Entire Layout */

.cd-section {
height: 100vh;
}
.cd-section > div {
height: 100%;
position: relative;
}
.content {
background-color: #ddd;
position: absolute;
width: calc(100% - 40px);
height: calc(100% - 80px);
left: 20px;
bottom: 20px;
overflow: hidden;
}

/* Header */
header {
position: fixed;
width: 100%;
top: 0;
left: 0;
}
.gnb-inner {
/* border: 1px solid #000; */
width: calc(100%-40px);
margin: auto;
height: 60px;
line-height: 60px;
}
.logo {
float: left;
}
.gnb {
float: right;
}

.menu {
display: none;
}

.menu a {
}

.slogan {
font-size: 16px;
font-style: italic;
}
.trigger {
display: none;
}

Responsive.css

@media (max-width: 768px) {
/* html {
scroll-behavior: smooth;
} */
/* Entire Layout */
.cd-section {
height: auto;
}
.cd-section > div {
height: auto;
}
.content {
position: static;
width: 100%;
height: 100%;
}
/* HEADER */

.slogan {
display: none;
}
.gnb {
background-color: #fff;
position: fixed;
top: 0;
right: -270px;
width: 250px;
height: 100vh;
box-shadow: -5px 0 10px rgba(0, 0, 0, 0.1);
transition: 0.5s;
}
.gnb.active {
right: 0;
}

.menu {
display: block;
line-height: 40px;
margin-top: 60px;
}

.menu a {
text-align: right;
display: block;
padding-right: 20px;
color: #000;
font-size: 20px;
}

/* trigger */
.trigger {
display: block;
width: 24px;
height: 14px;
position: absolute;
right: 20px;
top: 20px;
}
.trigger span {
position: absolute;
height: 1px;
width: 100%;
background-color: #000;
transition: 0.5s;
}

.trigger span:nth-child(1) {
top: 0;
}
.trigger span:nth-child(2) {
top: 50%;
width: 80%;
}
.trigger span:nth-child(3) {
top: 100%;
}

.trigger.active span:nth-child(1) {
top: 50%;
transform: rotate(45deg);
}
.trigger.active span:nth-child(2) {
top: 50%;
width: 80%;
opacity: 0;
}
.trigger.active span:nth-child(3) {
top: 50%;
transform: rotate(-45deg);
}
}

gnb가 오른쪽 right:-270px;에서

 active되면 right:0 되어야 하는데 안 나타나네요 ㅠㅠ

html에 gnb에 수동으로 active넣으면 흰색배경이 나타나는데

저는 어느부분이 오타가 난걸까요.. 

답변 1

답변을 작성해보세요.

0

.gnb { right: -270px;}

.gnb.active {right: 0;}

위의 responsive.css 코드는 맞습니다.

제이쿼리 코드가 없지만 제이쿼리에서 .gnb에 .active를 넣는 부분에 혹시 문제가 있지 않을까 합니다.