hamburgers.css 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*!
  2. * Hamburgers
  3. * @description Tasty CSS-animated hamburgers
  4. * @author Jonathan Suh @jonsuh
  5. * @site https://jonsuh.com/hamburgers
  6. * @link https://github.com/jonsuh/hamburgers
  7. */
  8. .hamburger {
  9. padding: 15px 15px;
  10. display: inline-block;
  11. cursor: pointer;
  12. transition-property: opacity, filter;
  13. transition-duration: 0.15s;
  14. transition-timing-function: linear;
  15. font: inherit;
  16. color: inherit;
  17. text-transform: none;
  18. background-color: transparent;
  19. border: 0;
  20. margin: 0;
  21. overflow: visible; }
  22. .hamburger:hover {
  23. opacity: 0.7; }
  24. .hamburger-box {
  25. width: 40px;
  26. height: 24px;
  27. display: inline-block;
  28. position: relative; }
  29. .hamburger-inner {
  30. display: block;
  31. top: 50%;
  32. margin-top: -2px; }
  33. .hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
  34. width: 40px;
  35. height: 4px;
  36. background-color: #000;
  37. border-radius: 4px;
  38. position: absolute;
  39. transition-property: transform;
  40. transition-duration: 0.15s;
  41. transition-timing-function: ease; }
  42. .hamburger-inner::before, .hamburger-inner::after {
  43. content: "";
  44. display: block; }
  45. .hamburger-inner::before {
  46. top: -10px; }
  47. .hamburger-inner::after {
  48. bottom: -10px; }
  49. /*
  50. * Collapse
  51. */
  52. .hamburger--collapse .hamburger-inner {
  53. top: auto;
  54. bottom: 0;
  55. transition-duration: 0.13s;
  56. transition-delay: 0.13s;
  57. transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); }
  58. .hamburger--collapse .hamburger-inner::after {
  59. top: -20px;
  60. transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), opacity 0.1s linear; }
  61. .hamburger--collapse .hamburger-inner::before {
  62. transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); }
  63. .hamburger--collapse.is-active .hamburger-inner {
  64. transform: translate3d(0, -10px, 0) rotate(-45deg);
  65. transition-delay: 0.22s;
  66. transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); }
  67. .hamburger--collapse.is-active .hamburger-inner::after {
  68. top: 0;
  69. opacity: 0;
  70. transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), opacity 0.1s 0.22s linear; }
  71. .hamburger--collapse.is-active .hamburger-inner::before {
  72. top: 0;
  73. transform: rotate(-90deg);
  74. transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1); }
  75. /*
  76. * Spring
  77. */
  78. .hamburger--spring .hamburger-inner {
  79. top: 2px;
  80. transition: background-color 0s 0.13s linear; }
  81. .hamburger--spring .hamburger-inner::before {
  82. top: 10px;
  83. transition: top 0.1s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); }
  84. .hamburger--spring .hamburger-inner::after {
  85. top: 20px;
  86. transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1), transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19); }
  87. .hamburger--spring.is-active .hamburger-inner {
  88. transition-delay: 0.22s;
  89. background-color: transparent; }
  90. .hamburger--spring.is-active .hamburger-inner::before {
  91. top: 0;
  92. transition: top 0.1s 0.15s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.22s cubic-bezier(0.215, 0.61, 0.355, 1);
  93. transform: translate3d(0, 10px, 0) rotate(45deg); }
  94. .hamburger--spring.is-active .hamburger-inner::after {
  95. top: 0;
  96. transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333), transform 0.13s 0.22s cubic-bezier(0.215, 0.61, 0.355, 1);
  97. transform: translate3d(0, 10px, 0) rotate(-45deg); }