Created
December 18, 2019 17:49
-
-
Save mcspx/adaf51fc06921ba7b3f82d921dde5afe to your computer and use it in GitHub Desktop.
Rounded Hexagon Menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %ul.menu | |
| %li.active | |
| %a.menu-handle | |
| %div.menu-handle-container | |
| %div.menu-handle-content | |
| %i.menu-handle-hamburger ☰ | |
| %strong.menu-handle-icon | |
| %i.fa.fa-home | |
| %ul.sub-menu | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-file-text-o | |
| %strong Summary | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-user | |
| %strong Account Profile | |
| %li.menu-item | |
| %div | |
| .color- | |
| %i.fa.fa-wrench | |
| %strong Integration | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-inbox | |
| %strong Messages Archives | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-file-o | |
| %strong Files | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-users | |
| %strong Team Directory | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-bar-chart | |
| %strong Statistics | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-magic | |
| %strong Customize | |
| %li.menu-item | |
| %div | |
| %div | |
| %i.fa.fa-cogs | |
| %strong Team Settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.menu>li').on('click', this.toggleClass('active')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin colorize($color) { | |
| &:hover, &:focus, &.active { | |
| > div, > div:before, >div:after { | |
| @if hue($color) > 20 { | |
| background: $color; | |
| } | |
| } | |
| > div > div > strong { | |
| @if hue($color) > 20 { | |
| color: white; | |
| } | |
| @else { | |
| color: invert($color); | |
| } | |
| } | |
| } | |
| > div > div { | |
| -webkit-transition: color 0s; | |
| transition: color 0s; | |
| color: $color; | |
| } | |
| } | |
| @mixin hexagon($height, $background-color:#ccc, $color:#000, $border-color:none) { | |
| -webkit-transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| width: calc(#{$height} * 0.63); | |
| height: $height; | |
| display: inline-block; | |
| vertical-align: middle; | |
| padding: 0 calc(#{$height} * 0.26); | |
| position: relative; | |
| > div { | |
| -webkit-transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| height: 100%; | |
| background: $background-color; | |
| position: relative; | |
| border-radius: calc(#{$height} * 0.1); | |
| @if variable-exists(border-color) { | |
| border: solid 1px $border-color; | |
| } | |
| &:before, &:after { | |
| -webkit-transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| content: ""; | |
| position: absolute; | |
| top: calc(#{$height} * 0.08); | |
| background: $background-color; | |
| width: calc(#{$height} * 0.85); | |
| height: calc(#{$height} * 0.85); | |
| border-radius: calc(#{$height} * 0.1); | |
| @if variable-exists(border-color) { | |
| box-shadow: inset 2px 2px 0px $border-color; | |
| } | |
| z-index: -1; | |
| } | |
| &:before { | |
| left: calc(#{$height} / -2.557); | |
| right: initial; | |
| -webkit-transform: matrix(0.355, -0.583, 0.365, 0.583, 0, 0); | |
| -ms-transform: matrix(0.355, -0.583, 0.365, 0.583, 0, 0); | |
| transform: matrix(0.355, -0.583, 0.365, 0.583, 0, 0); | |
| } | |
| &:after { | |
| left: initial; | |
| right: calc(#{$height} / -2.557); | |
| -webkit-transform: matrix(-0.355, 0.583, -0.365, -0.583, 0, 0); | |
| -ms-transform: matrix(-0.355, 0.583, -0.365, -0.583, 0, 0); | |
| transform: matrix(-0.355, 0.583, -0.365, -0.583, 0, 0); | |
| } | |
| > div { | |
| -webkit-transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| transition: all cubic-bezier(1,-0.08,.57,1) 0.3s; | |
| height: 100%; | |
| position: relative; | |
| left: calc(#{$height} * -0.28); | |
| width: 113%; | |
| min-width: calc(#{$height} * 1.17); | |
| line-height: $height; | |
| text-align: center; | |
| font-family: Lato,Roboto,appleLogo,Trebuchet MS; | |
| font-weight: bold; | |
| overflow: hidden; | |
| > i { | |
| display: inline-block; | |
| -webkit-transition: all 0s; | |
| transition: all 0s; | |
| opacity: 1; | |
| width: 100%; | |
| font-size: calc(#{$height} * 0.5); | |
| height: 100%; | |
| vertical-align: middle; | |
| line-height: $height; | |
| } | |
| > strong { | |
| -webkit-transition: opacity 0.5s; | |
| transition: opacity 0.5s; | |
| opacity: 0; | |
| line-height: normal; | |
| font-size: calc(#{$height} / 3); | |
| display: inline-block; | |
| vertical-align: middle; | |
| } | |
| } | |
| } | |
| } | |
| $color: #639cf5 #7bc180 #ffcf16 #9d7ca9 #639cf5 #da7a7b #7bc180 #ffcf16 #ffffff; | |
| html, body { | |
| width: 100%; | |
| height: 100%; | |
| } | |
| body { | |
| background: #518E8C; | |
| margin: 0; | |
| font-size: 0; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| transform: scale(1.5); | |
| overflow: hidden; | |
| } | |
| .menu { | |
| display: inline-block; | |
| position: relative; | |
| transform: scale(1); | |
| min-width: 400px; | |
| > li { | |
| -webkit-transition: width 1.8s; | |
| transition: width 1.8s; | |
| display: inline-block; | |
| white-space: nowrap; | |
| min-width: 117px; | |
| width: 0%; | |
| overflow: hidden; | |
| &:hover, &:focus, &.active { | |
| -webkit-transition: width 0.2s; | |
| transition: width 0.2s; | |
| width: 100%; | |
| .menu-handle { | |
| > .menu-handle-container { | |
| &, > &:before, > &:after { | |
| background: darken(#aaa, 20%); | |
| } | |
| } | |
| > .menu-handle-container > .menu-handle-content > .menu-handle-hamburger { | |
| opacity: 0; | |
| } | |
| > .menu-handle-container > .menu-handle-content > .menu-handle-icon { | |
| opacity: 1; | |
| cursor: pointer; | |
| } | |
| &:hover, &:focus, &.active { | |
| + .sub-menu .menu-item { | |
| opacity: 1; | |
| } | |
| } | |
| } | |
| .menu-item { | |
| opacity: 1; | |
| } | |
| } | |
| .menu-handle { | |
| @include hexagon(100px, #aaa); | |
| cursor: default; | |
| margin-right: 2px; | |
| > .menu-handle-container > .menu-handle-content { | |
| transition: all 0.3s; | |
| font-size: 55px; | |
| color: black; | |
| top: -6px; | |
| white-space: nowrap; | |
| } | |
| > .menu-handle-container > .menu-handle-content > .menu-handle-hamburger { | |
| transition: all cubic-bezier(1, -0.08, .57, 1) 0.3s; | |
| opacity: 1; | |
| font-style: initial; | |
| left: 1px; | |
| position: absolute; | |
| top: 5px; | |
| } | |
| > .menu-handle-container > .menu-handle-content > .menu-handle-icon { | |
| -webkit-transition: all cubic-bezier(1, -0.08, .57, 1) 0.3s; | |
| transition: all cubic-bezier(1, -0.08, .57, 1) 0.3s; | |
| opacity: 0; | |
| color: white; | |
| font-size: 58px; | |
| left: 1px; | |
| position: absolute; | |
| top: 20px; | |
| width: 100%; | |
| height: 100%; | |
| } | |
| } | |
| .sub-menu { | |
| display: inline-block; | |
| padding-left: 0px; | |
| } | |
| .menu-item { | |
| @include hexagon(50px); | |
| -webkit-transition: all 0.3s; | |
| transition: all 0.3s; | |
| opacity: 0; | |
| font-size: 12px; | |
| display: inline-block; | |
| &:hover, &:focus, &.active { | |
| width: 200px; | |
| cursor: pointer; | |
| > div > div > i { | |
| opacity: 0; | |
| width: 0; | |
| } | |
| > div > div > strong { | |
| -webkit-transition: opacity 0.8s; | |
| transition: opacity 0.8s; | |
| position: relative; | |
| opacity: 1; | |
| left: -2%; | |
| } | |
| } | |
| &:nth-child(3n+1) { | |
| top: -26px; | |
| left: -12px; | |
| margin-right: -25px; | |
| &:hover, &:focus, &.active { | |
| + .menu-item { | |
| left: -212px; | |
| } | |
| } | |
| } | |
| &:nth-child(3n+2) { | |
| left: -44px; | |
| top: 28px; | |
| margin-right: -62px; | |
| } | |
| &:nth-child(3n+3) { | |
| top: 0; | |
| left: 9px; | |
| margin-right: 11px; | |
| } | |
| $delay: 0.1s; | |
| $transition-delay: 9 * $delay; | |
| $n: 1; | |
| @each $i in $color { | |
| &:nth-child(#{$n}) { | |
| @include colorize($i); | |
| $tmp: $transition-delay; | |
| $transition-delay: $tmp - $delay; | |
| -webkit-transition: opacity $transition-delay, width 0.4s, left 0.4s; | |
| transition: opacity $transition-delay, width 0.4s, left 0.4s; | |
| } | |
| $n: $n+1; | |
| } | |
| } | |
| $delay: 0.2s; | |
| $transition-delay-hover: 0s; | |
| $n: 1; | |
| @each $i in $color { | |
| &:hover, &:focus, &.active { | |
| .menu-item:nth-child(#{$n}) { | |
| $tmp: $transition-delay-hover; | |
| $transition-delay-hover: $tmp + $delay; | |
| -webkit-transition: opacity $transition-delay-hover, width 0.4s, left 0.4s; | |
| transition: opacity $transition-delay-hover, width 0.4s, left 0.4s; | |
| } | |
| $n: $n+1; | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment