Skip to content

Commit

Permalink
hamburger bar
Browse files Browse the repository at this point in the history
  • Loading branch information
jzc16101 committed Feb 16, 2020
1 parent d522391 commit b41133c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
45 changes: 42 additions & 3 deletions css/mobile-first.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,45 @@
#section1 {
margin: 50px;
}
/* Hamburger Bar */
.container {
display: inline-block;
cursor: pointer;

}

.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px 0;
transition: 0.4s;
}

/* Rotate first bar */
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-9px, 6px) ;
transform: rotate(-45deg) translate(-9px, 6px) ;
}

/* Fade out the second bar */
.change .bar2 {
opacity: 0;
}

/* Rotate last bar */
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px) ;
transform: rotate(45deg) translate(-8px, -8px) ;
}
nav {
visibility: hidden;
}
/*Desktop*/
@media (min-width: 768px){
@media (min-width: 768px) {
nav {
visibility: visible;
}
div.centered {
width:80%;
margin: 0 auto;
Expand Down Expand Up @@ -252,7 +288,7 @@
}
ul {
display: flex;
justify-content: space-around;
justify-content: space-between;
}
.half {
width: 50%;
Expand All @@ -261,11 +297,14 @@
margin: 0;
}
form {
margin-left: 50%;
margin:50px 0 0 35%;
}
#section1 {
margin: none;
}
.container {
visibility: hidden;
}

}
/* ==========================================================================
Expand Down
7 changes: 6 additions & 1 deletion mobile-first.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
<div class="centered">
<div class="logo">
<img src="img/logo_navbar_u70.png" alt="logo">
</div>
</div>
<div class="container" onclick="myFunction(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
<nav>
<ul>
<li><a href="#">Features</a></li>
Expand Down
3 changes: 3 additions & 0 deletions mobile-first.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function myFunction(x) {
x.classList.toggle("change");
}

0 comments on commit b41133c

Please sign in to comment.