Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lmgonzalves committed Jan 20, 2017
0 parents commit d31f578
Show file tree
Hide file tree
Showing 7 changed files with 753 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
node_modules/
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2017 lmgonzalves

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Morphing Hamburger Menu

A CSS only Morphing Hamburger Menu, based on a [dribbble shot](https://dribbble.com/shots/2293621-Hamburger-Menu-Animation) by Vitaly Rubtsov.

[**DEMO**](http://lmgonzalves.github.io/morphing-hamburger-menu/)

**TUTORIAL** (coming soon)

[**CODEPEN**](http://codepen.io/lmgonzalves/pen/KaWaJO?editors=1100)
347 changes: 347 additions & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,347 @@
/* Basic styles */
* {
box-sizing: border-box;
}

html, body {
margin: 0;
}

body {
font-family: sans-serif;
background-color: #F6C390;
}

a {
text-decoration: none;
}

.container {
position: relative;
margin: 35px auto 0;
width: 300px;
height: 534px;
background-color: #533557;
overflow: hidden;
}

/* Toggle functionality */
#toggle {
display: none;
}

#toggle:checked ~ .toggle-container .button-toggle {
box-shadow: 0 0 0 550px rgba(0, 0, 0, 0.1), inset 0 0 0 20px rgba(0, 0, 0, 0.1);
}

#toggle:checked ~ .toggle-container .button-toggle:before {
-webkit-transform: translateY(-50%) rotate(45deg) scale(1);
-ms-transform: translateY(-50%) rotate(45deg) scale(1);
transform: translateY(-50%) rotate(45deg) scale(1);
}

#toggle:checked ~ .toggle-container .button-toggle:after {
-webkit-transform: translateY(-50%) rotate(-45deg) scale(1);
-ms-transform: translateY(-50%) rotate(-45deg) scale(1);
transform: translateY(-50%) rotate(-45deg) scale(1);
}

#toggle:checked ~ .nav {
margin-bottom: 100px;
pointer-events: auto;
-webkit-transform: translate(50px, 50px);
-ms-transform: translate(50px, 50px);
transform: translate(50px, 50px);
}

#toggle:checked ~ .nav .nav-item {
color: #EC7263;
letter-spacing: 0;
height: 40px;
line-height: 40px;
margin-top: 0;
opacity: 1;
-webkit-transform: scaleY(1);
-ms-transform: scaleY(1);
transform: scaleY(1);
-webkit-transition: 0.5s, opacity 0.1s;
transition: 0.5s, opacity 0.1s;
}

#toggle:checked ~ .nav .nav-item:nth-child(1) {
-webkit-transition-delay: 0.15s;
transition-delay: 0.15s;
}

#toggle:checked ~ .nav .nav-item:nth-child(1):before {
-webkit-transition-delay: 0.15s;
transition-delay: 0.15s;
}

#toggle:checked ~ .nav .nav-item:nth-child(2) {
-webkit-transition-delay: 0.1s;
transition-delay: 0.1s;
}

#toggle:checked ~ .nav .nav-item:nth-child(2):before {
-webkit-transition-delay: 0.1s;
transition-delay: 0.1s;
}

#toggle:checked ~ .nav .nav-item:nth-child(3) {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
}

#toggle:checked ~ .nav .nav-item:nth-child(3):before {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
}

#toggle:checked ~ .nav .nav-item:nth-child(4) {
-webkit-transition-delay: 0s;
transition-delay: 0s;
}

#toggle:checked ~ .nav .nav-item:nth-child(4):before {
-webkit-transition-delay: 0s;
transition-delay: 0s;
}

#toggle:checked ~ .nav .nav-item:before {
opacity: 0;
}

#toggle:checked ~ .dummy-content {
padding-top: 30px;
}

#toggle:checked ~ .dummy-content:before {
background-color: rgba(0, 0, 0, 0.3);
}

/* Toggle button */
.button-toggle {
position: absolute;
display: inline-block;
width: 20px;
height: 20px;
margin: 25px;
background-color: transparent;
border: none;
cursor: pointer;
border-radius: 100%;
-webkit-transition: 0.6s;
transition: 0.6s;
}

.button-toggle:hover {
box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.1), inset 0 0 0 20px rgba(0, 0, 0, 0.1);
}

.button-toggle:before, .button-toggle:after {
position: absolute;
content: '';
top: 50%;
left: 0;
width: 100%;
height: 2px;
background-color: #EC7263;
border-radius: 5px;
-webkit-transition: 0.5s;
transition: 0.5s;
}

.button-toggle:before {
-webkit-transform: translateY(-50%) rotate(45deg) scale(0);
-ms-transform: translateY(-50%) rotate(45deg) scale(0);
transform: translateY(-50%) rotate(45deg) scale(0);
}

.button-toggle:after {
-webkit-transform: translateY(-50%) rotate(-45deg) scale(0);
-ms-transform: translateY(-50%) rotate(-45deg) scale(0);
transform: translateY(-50%) rotate(-45deg) scale(0);
}

/* Menu */
.nav {
display: inline-block;
margin: 25px 25px 20px;
pointer-events: none;
-webkit-transition: 0.5s;
transition: 0.5s;
}

.nav-item {
position: relative;
display: inline-block;
float: left;
clear: both;
color: transparent;
font-size: 14px;
letter-spacing: -6.2px;
height: 7px;
line-height: 7px;
text-transform: uppercase;
white-space: nowrap;
-webkit-transform: scaleY(0.2);
-ms-transform: scaleY(0.2);
transform: scaleY(0.2);
-webkit-transition: 0.5s, opacity 1s;
transition: 0.5s, opacity 1s;
}

.nav-item:nth-child(1) {
-webkit-transition-delay: 0s;
transition-delay: 0s;
}

.nav-item:nth-child(1):before {
-webkit-transition-delay: 0s;
transition-delay: 0s;
}

.nav-item:nth-child(2) {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
}

.nav-item:nth-child(2):before {
-webkit-transition-delay: 0.05s;
transition-delay: 0.05s;
}

.nav-item:nth-child(3) {
-webkit-transition-delay: 0.1s;
transition-delay: 0.1s;
}

.nav-item:nth-child(3):before {
-webkit-transition-delay: 0.1s;
transition-delay: 0.1s;
}

.nav-item:nth-child(4) {
-webkit-transition-delay: 0.15s;
transition-delay: 0.15s;
}

.nav-item:nth-child(4):before {
-webkit-transition-delay: 0.15s;
transition-delay: 0.15s;
}

.nav-item:nth-child(1) {
letter-spacing: -8px;
}

.nav-item:nth-child(2) {
letter-spacing: -7px;
}

.nav-item:nth-child(n + 4) {
letter-spacing: -8px;
margin-top: -7px;
opacity: 0;
}

.nav-item:before {
position: absolute;
content: '';
top: 50%;
left: 0;
width: 100%;
height: 2px;
background-color: #EC7263;
-webkit-transform: translateY(-50%) scaleY(5);
-ms-transform: translateY(-50%) scaleY(5);
transform: translateY(-50%) scaleY(5);
-webkit-transition: 0.5s;
transition: 0.5s;
}

/* Dummy content */
.dummy-content {
position: relative;
text-align: center;
-webkit-transition: 0.5s;
transition: 0.5s;
}

.dummy-content:before {
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: transparent;
z-index: 2;
-webkit-transition: 0.5s;
transition: 0.5s;
}

.circle {
display: inline-block;
width: 75px;
height: 75px;
background-color: #EC7263;
border-radius: 100%;
}

.text {
margin: 15px 0 30px;
}

.text span {
display: inline-block;
height: 10px;
margin: 0 5px;
background-color: #C06162;
border-radius: 5px;
}

.text span:first-child {
width: 50px;
}

.text span:last-child {
width: 80px;
}

.square-top {
display: inline-block;
position: relative;
width: 200px;
height: 300px;
background-color: #FEBE7E;
z-index: 1;
}

.square-behind {
display: inline-block;
position: relative;
top: -256px;
width: 250px;
height: 210px;
background-color: #C28683;
}

.square-behind:before, .square-behind:after {
position: absolute;
content: '';
top: 0;
width: 40%;
height: 100%;
}

.square-behind:before {
left: 0;
background-color: #9D567C;
}

.square-behind:after {
right: 0;
background-color: #958C6B;
}
Loading

0 comments on commit d31f578

Please sign in to comment.