_nav-toggle.scss 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. $button-size : 2rem;
  2. $transition: .3s; // increase this to see the transformations in slow-motion
  3. @mixin line {
  4. display: inline-block;
  5. width: $button-size;
  6. height: $button-size / 7;
  7. border-radius: $button-size / 14;
  8. transition: $transition;
  9. }
  10. .lines-button {
  11. display: inline-block;
  12. padding: $button-size / 4 $button-size / 4 $button-size / 2;
  13. transition: .3s;
  14. cursor: pointer;
  15. user-select: none;
  16. border-radius: $button-size / 5;
  17. position: absolute;
  18. z-index: 100002;
  19. top: 10px;
  20. background: transparent;
  21. &:hover {
  22. opacity: 1;
  23. }
  24. &:active {
  25. transition: none;
  26. background: rgba(0, 0, 0, .1);
  27. }
  28. }
  29. .lines {
  30. position: relative;
  31. @include line;
  32. /*create the upper and lower lines as pseudo-elements of the middle line*/
  33. &:before, &:after {
  34. @include line;
  35. position: absolute;
  36. left:0;
  37. content: '';
  38. transform-origin: $button-size / 14 center;
  39. }
  40. &:before { top: $button-size / 4; }
  41. &:after { top: -$button-size / 4; }
  42. }
  43. .sidebar-mobile-open .lines-button.x .lines {
  44. /*hide the middle line*/
  45. background: transparent !important;
  46. /*overlay the lines by setting both their top values to 0*/
  47. &:before, &:after{
  48. transform-origin: 50% 50%;
  49. top:0;
  50. width: $button-size;
  51. }
  52. // rotate the lines to form the x shape
  53. &:before{
  54. transform: rotate3d(0, 0, 1, 45deg);
  55. }
  56. &:after{
  57. transform: rotate3d(0, 0, 1, -45deg);
  58. }
  59. }