Files
ycb.vn/assets/styles/_menus.scss
T
Thuan Bui c5865ef889 Init
2017-10-05 10:05:14 +07:00

337 lines
7.3 KiB
SCSS

/* ## Menus
--------------------------------------------- */
.menu {
width: 100%;
font-family: $font-heading;
font-weight: $bolder;
font-size: 1.8rem;
line-height: 1;
text-align: center;
text-transform: uppercase;
display: flex;
flex-wrap: wrap;
@include clearfix;
@include breakpoint(md) {
text-align: left;
font-size: 1.2rem;
}
}
.menu-item {
display: block;
padding: 0.5em 0;
width: 100%;
position: relative;
@include breakpoint(md) {
display: inline-block;
padding: 0;
width: auto;
}
&.right {
margin-left: auto;
}
&:hover,
&:focus,
&.sfHover {
outline: none;
>.sub-menu {
@include breakpoint(md) {
opacity: 1 !important;
margin-top: -1em;
pointer-events: all;
}
}
.sub-menu & {
.sub-menu {
margin-top: -1em;
}
}
}
a {
width: auto;
text-decoration: none;
display: inline-block;
padding: 0.5em 0;
color: $border;
@include breakpoint(md) {
padding: 1.6em 1em;
width: 100%;
}
@include breakpoint(lg) {
padding: 3em 1.25em;
}
&:focus {
outline: none;
}
span {
position: relative;
}
}
a:hover,
a:focus,
&.current-menu-item>a {
color: $white;
span {
&:after {
width: 100%;
}
}
.sub-menu & {
color: $gray;
}
}
}
/* ## Sub Menus
--------------------------------------------- */
.sub-menu {
display: none;
font-size: 1.4rem;
padding: 1em 0;
@include clearfix;
@include breakpoint(md) {
position: absolute;
width: 18rem;
z-index: 99;
border-radius: $site-radius;
background-color: $white;
padding: 0.618em 0.5em;
margin: 0;
font-size: 1.2rem;
display: block !important;
opacity: 0 !important;
transition: all .25s ease-in-out;
pointer-events: none;
box-shadow: 0 0.5rem 1.5rem rgba($dark,0.05);
&:before {
content: '';
display: block;
position: absolute;
top: -1rem;
left: 3rem;
border: 0.5rem solid transparent;
border-bottom-color: $white;
}
}
li {
width: 100%;
&:first-of-type {
margin-top: 0.5em; // Slide toggle fix.
@include breakpoint(md) {
margin-top: 0;
}
a {
padding-left: 1em;
}
}
}
a {
padding-left: 1em;
@include breakpoint(md) {
padding: 1em;
position: relative;
word-wrap: break-word;
color: $dark;
}
@include breakpoint(lg) {
padding: 1em;
}
}
.sub-menu {
padding-left: 1em;
@include breakpoint(md) {
margin: 0 0 0 18.2rem;
padding-left: 0.5em;
left: 0;
top: 0;
}
&:before {
@include breakpoint(md) {
position: absolute;
top: 2em;
left: -1rem;
border: 0.5rem solid transparent;
border-right-color: $white;
}
}
}
}
/* ## Specific Menus
--------------------------------------------- */
.nav-primary {
width: 100vw;
margin: auto;
padding: 5vw;
background-color: rgba($dark,0.98);
border-top: $site-border;
border-bottom: $site-border;
position: fixed;
overflow: auto;
overflow-x: visible;
-webkit-overflow-scrolling: touch;
left: 5vw;
top: -1rem;
left: -1rem;
right: -1rem;
bottom: -1rem;
display: none;
@include breakpoint(md) {
background-color: transparent;
border: none;
position: relative;
top: auto;
left: auto;
right: auto;
bottom: auto;
width: auto;
display: block;
margin: 0;
padding: 0;
overflow: initial;
-webkit-overflow-scrolling: initial;
}
&.visible {
display: block;
}
.no-js & {
width: 100%;
position: relative;
display: block;
@include breakpoint(md) {
display: block;
width: auto;
}
.wrap {
padding: 0 5%;
}
.menu-item {
display: inline-block;
width: auto;
margin: 0 0.5em;
}
}
.wrap {
height: 100%;
}
.menu {
min-height: 100%;
padding: 0 0 1em;
flex-direction: column;
justify-content: center;
@include breakpoint(md) {
padding: 0;
flex-direction: row;
justify-content: flex-end;
padding: 0;
}
}
}
/* ## Menu Toggles
--------------------------------------------- */
.menu-toggle {
padding: 2.7rem 0;
cursor: pointer;
background-color: transparent;
display: block;
position: absolute;
right: 5vw;
top: 0;
line-height: 1;
color: transparent;
letter-spacing: -0.5em;
z-index: 999;
@include breakpoint(md) {
display: none;
}
&:hover,
&:focus {
background: none;
outline: none;
box-shadow: none;
color: transparent;
}
&.activated {
position: fixed;
}
span {
display: block;
float: right;
position: relative;
height: 0.2rem;
background: $white;
transition: background 0s 0.2s;
width: 2.5rem;
margin-left: 0.236em;
margin-top: 0.7rem;
border-radius: $site-radius;
&::before,
&::after {
position: absolute;
display: block;
left: 0;
width: 100%;
height: 0.2rem;
background-color: $white;
border-radius: $site-radius;
content: " ";
}
&::before {
top: -0.7rem;
transition: top 0.2s 0.2s, transform 0.2s 0s;
}
&::after {
bottom: -0.7rem;
transition: bottom 0.2s 0.2s, transform 0.2s 0s;
}
}
&.activated span {
background: none;
&::before {
top: 0;
transform: rotate(45deg);
transition: top 0.2s 0s, transform 0.2s 0.2s;
}
&::after {
bottom: 0;
transform: rotate(-45deg);
transition: bottom 0.2s 0s, transform 0.2s 0.2s;
}
}
}
.sub-menu-toggle {
position: absolute;
background-color: transparent;
padding: 0.75em;
margin: 0 -1em 0 1em;
@include breakpoint(md) {
display: none;
}
&:hover,
&:focus {
background: none;
}
&:before {
content: "";
display: block;
margin: 0.2rem 0 -0.2rem;
border: 0.4rem solid transparent;
border-top-color: $light;
}
&.activated {
&:before {
transform: rotate(180deg);
margin: -0.2rem 0 0.2rem;
}
}
}