Guest User

Untitled

a guest
Jan 19th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. <nav>
  2.  
  3. <div class="outer_menu">
  4. <input class="checkbox_toggle" type="checkbox" />
  5. <div class="hamburger">
  6. <div></div>
  7. </div>
  8. <div class="menu">
  9. <div>
  10. <div>
  11. <ul>
  12. <li><a href="#">About</a></li>
  13. <li><a href="#">Products</a></li>
  14. <li><a href="#">Blog</a></li>
  15. <li><a href="#">Contact</a></li>
  16. </ul>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21.  
  22. </nav>
  23.  
  24. // необязательно nav
  25. nav
  26. position: relative
  27. height: 50px
  28. background-color: green
  29.  
  30. /* begin menu */
  31.  
  32. $max-width: 1000
  33. $hamburger-menu-size: 60px
  34. $hamburger-menu-border-radius: .12em
  35. $hamburger-menu-bg-color: rgba(255,255,255,.75)
  36. $hamburger-menu-color: #5d257c
  37. $hamburger-menu-line-height: 2px
  38. $hover-line-height: $hamburger-menu-line-height
  39. $content-bg-color: rgba(93,37,124,.97)
  40. $content-color: #fff
  41. $hover-color: darken($content-color,10%)
  42. $anim-duration: .4s
  43.  
  44. .outer_menu
  45. a,
  46. a:visited,
  47. a:hover,
  48. a:active
  49. color: inherit
  50. text-decoration: none
  51.  
  52. .outer_menu
  53. font-size: 14px
  54. position: absolute
  55. top: 0
  56. left: 0
  57. z-index: 99
  58.  
  59. .checkbox_toggle
  60. position: absolute
  61. top: 0
  62. left: 0
  63. z-index: 2
  64. cursor: pointer
  65. width: $hamburger-menu-size
  66. height: $hamburger-menu-size
  67. opacity: 0
  68.  
  69. &:checked
  70. & + .hamburger
  71. > div
  72. transform: rotate(135deg)
  73.  
  74. &:before,
  75. &:after
  76. top: 0
  77. transform: rotate(90deg)
  78.  
  79. &:after
  80. opacity: 0
  81.  
  82. & ~ .menu
  83. pointer-events: auto
  84. visibility: visible
  85.  
  86. > div
  87. transform: scale(1)
  88. transition-duration: .75s
  89.  
  90. > div
  91. opacity: 1
  92. transition: opacity $anim-duration ease $anim-duration
  93.  
  94. &:hover + .hamburger
  95. box-shadow: inset 0 0 10px rgba(0, 0, 0, .1)
  96.  
  97. &:checked:hover + .hamburger > div
  98. transform: rotate(225deg)
  99.  
  100. .hamburger
  101. display: none
  102. position: absolute
  103. top: 0
  104. left: 0
  105. z-index: 1
  106. width: $hamburger-menu-size
  107. height: $hamburger-menu-size
  108. padding: .5em 1em
  109. background: $hamburger-menu-bg-color
  110. border-radius: 0 $hamburger-menu-border-radius $hamburger-menu-border-radius 0
  111. cursor: pointer
  112. transition: box-shadow $anim-duration ease
  113. backface-visibility: hidden
  114. +r($max-width)
  115. display: block
  116.  
  117. > div
  118. position: relative
  119. flex: none
  120. width: 100%
  121. height: $hamburger-menu-line-height
  122. background: $hamburger-menu-color
  123. transition: all $anim-duration ease
  124. top: 20px
  125.  
  126. &:before,
  127. &:after
  128. content: ''
  129. position: absolute
  130. z-index: 1
  131. top: -$hamburger-menu-size / 6
  132. left: 0
  133. width: 100%
  134. height: $hamburger-menu-line-height
  135. background: inherit
  136. transition: all $anim-duration ease
  137.  
  138. &:after
  139. top: $hamburger-menu-size / 6
  140.  
  141. .menu
  142. position: fixed
  143. top: 0
  144. left: 0
  145. width: 100%
  146. height: 100%
  147. pointer-events: none
  148. overflow: hidden
  149. backface-visibility: hidden
  150. outline: 1px solid transparent
  151. +r($max-width)
  152. visibility: hidden
  153.  
  154. > div
  155. width: 100vw
  156. height: 100vw
  157. color: $content-color
  158. transition: all $anim-duration ease
  159. flex: none
  160. backface-visibility: hidden
  161. overflow: hidden
  162. +r($max-width)
  163. transform: scale(0)
  164. background: $content-bg-color
  165.  
  166. > div
  167. text-align: center
  168. max-width: 90vw
  169. max-height: 100vh
  170. transition: opacity $anim-duration ease
  171. overflow: hidden
  172. flex: none
  173. +r($max-width)
  174. opacity: 0
  175.  
  176. > ul
  177. list-style: none
  178. padding: 0 1em
  179. margin: 0
  180. display: block
  181. max-height: 100vh
  182.  
  183. > li
  184. padding: 0
  185. margin: 1em
  186. font-size: 24px
  187. display: inline-block
  188. +r($max-width)
  189. display: block
  190.  
  191. > a
  192. position: relative
  193. display: inline-block
  194. cursor: pointer
  195. transition: color $anim-duration ease
  196.  
  197. &:hover
  198. color: $hover-color
  199.  
  200. &:after
  201. width: 100%
  202.  
  203. &:after
  204. content: ''
  205. position: absolute
  206. z-index: 1
  207. bottom: -.15em
  208. left: 0
  209. width: 0
  210. height: $hover-line-height
  211. background: $hover-color
  212. transition: width $anim-duration ease
  213.  
  214. /* end menu */
Add Comment
Please, Sign In to add comment