Skip to content

Commit 709e3bf

Browse files
committed
Menu overlay & function set-text-color
1 parent 51d8f62 commit 709e3bf

File tree

4 files changed

+160
-2
lines changed

4 files changed

+160
-2
lines changed

dist/css/main.css

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
width: 28px;
1111
height: 3px;
1212
margin: 0 0 5px 0;
13-
background: set-text-color(#383737);
13+
background: #fff;
1414
transition: all 0.5s ease-out; }
1515
.menu-btn.close {
1616
transform: rotate(180deg); }
@@ -21,6 +21,76 @@
2121
.menu-btn.close .btn-line:nth-child(3) {
2222
transform: rotate(-45deg) translate(7px, -6px); }
2323

24+
.menu {
25+
position: fixed;
26+
top: 0;
27+
width: 100%;
28+
opacity: 0.9;
29+
visibility: hidden; }
30+
.menu.show {
31+
visibility: visible; }
32+
.menu-photo, .menu-nav {
33+
display: flex;
34+
flex-flow: column wrap;
35+
align-items: center;
36+
justify-content: center;
37+
float: left;
38+
width: 50%;
39+
height: 100vh;
40+
overflow: hidden; }
41+
.menu-nav {
42+
margin: 0;
43+
padding: 0;
44+
background: #2b2a2a;
45+
list-style: none;
46+
transform: translate3d(0, -100%, 0);
47+
transition: all 0.5s ease-out; }
48+
.menu-nav.show {
49+
transform: translate3d(0, 0, 0); }
50+
.menu-photo {
51+
background: #383737;
52+
transform: translate3d(0, 100%, 0);
53+
transition: all 0.5s ease-out; }
54+
.menu-photo.show {
55+
transform: translate3d(0, 0, 0); }
56+
.menu-photo .portrait {
57+
width: 250px;
58+
height: 250px;
59+
background: url("../img/portrait.jpg");
60+
border-radius: 50%;
61+
border: solid 3px #6b9feee7; }
62+
.menu .nav-item {
63+
transform: translate3d(600px, 0, 0);
64+
transition: all 0.5s ease-out; }
65+
.menu .nav-item.show {
66+
transform: translate3d(0, 0, 0); }
67+
.menu .nav-item.current > a {
68+
color: #6b9feee7; }
69+
.menu .nav-link {
70+
display: inline-block;
71+
position: relative;
72+
font-size: 30px;
73+
text-transform: uppercase;
74+
padding: 1rem 0;
75+
font-weight: 400;
76+
color: #fff;
77+
text-decoration: none;
78+
transition: all 0.5s ease-out; }
79+
.menu .nav-link:hover {
80+
color: #6b9feee7; }
81+
82+
.nav-item:nth-child(1) {
83+
transition-delay: 0.1s; }
84+
85+
.nav-item:nth-child(2) {
86+
transition-delay: 0.2s; }
87+
88+
.nav-item:nth-child(3) {
89+
transition-delay: 0.3s; }
90+
91+
.nav-item:nth-child(4) {
92+
transition-delay: 0.4s; }
93+
2494
* {
2595
box-sizing: border-box; }
2696

scss/_config.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,12 @@ $background-opacity: 0.7;
2727
}
2828
}
2929
}
30+
31+
// Set text color
32+
@function set-text-color($color) {
33+
@if (lightness($color) > 40) {
34+
@return #000;
35+
} @else {
36+
@return #fff;
37+
}
38+
}

scss/_menu.scss

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,83 @@
2929
} // line 3: rotate
3030
}
3131
}
32+
}
33+
34+
// Menu overlay
35+
.menu {
36+
position: fixed;
37+
top: 0;
38+
width: 100%;
39+
opacity: 0.9;
40+
visibility: hidden;
41+
&.show {
42+
visibility: visible;
43+
}
44+
&-photo, &-nav {
45+
display: flex;
46+
flex-flow: column wrap;
47+
align-items: center;
48+
justify-content: center;
49+
float: left;
50+
width: 50%;
51+
height: 100vh;
52+
overflow: hidden;
53+
}
54+
&-nav {
55+
margin: 0;
56+
padding: 0;
57+
background: darken($color: $primary-color, $amount: 5);
58+
list-style: none;
59+
transform: translate3d(0, -100%, 0);
60+
@include easeOut;
61+
&.show {
62+
transform: translate3d(0,0,0); // slide in from the top
63+
}
64+
}
65+
&-photo {
66+
background: $primary-color;
67+
transform: translate3d(0, 100%, 0);
68+
@include easeOut;
69+
&.show {
70+
transform: translate3d(0,0,0); // slide in from the bottom
71+
}
72+
.portrait {
73+
width: 250px;
74+
height: 250px;
75+
background: url('../img/portrait.jpg');
76+
border-radius: 50%;
77+
border: solid 3px $secondary-color;
78+
}
79+
}
80+
.nav-item {
81+
transform: translate3d(600px, 0, 0);
82+
@include easeOut;
83+
&.show {
84+
transform: translate3d(0,0,0); // slide in from the right
85+
}
86+
&.current > a {
87+
color: $secondary-color;
88+
}
89+
}
90+
.nav-link {
91+
display: inline-block;
92+
position: relative;
93+
font-size: 30px;
94+
text-transform: uppercase;
95+
padding: 1rem 0;
96+
font-weight: 400;
97+
color: set-text-color($primary-color);
98+
text-decoration: none;
99+
@include easeOut;
100+
&:hover {
101+
color: $secondary-color;
102+
}
103+
}
104+
}
105+
106+
// Delay each nav item slide by 0.1s
107+
@for $x from 1 through 4 {
108+
.nav-item:nth-child(#{$x}) {
109+
transition-delay: $x * 0.1s;
110+
}
32111
}

scss/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
body {
1010
@include background;
1111
background: $primary-color;
12-
color: #fff;
12+
color: set-text-color($primary-color);
1313
height: 100%;
1414
margin: 0;
1515
font-family: 'Raleway', sans-serif;

0 commit comments

Comments
 (0)