Guest User

Untitled

a guest
Oct 23rd, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. PUG:
  2. button.toggle-menu
  3. span.sandwich
  4. span.sw-topper
  5. span.sw-bottom
  6. span.sw-footer
  7.  
  8. nav.main-navigation
  9. a(href="#") Обо мне
  10. a(href="#") Резюме
  11. a(href="#") Портфолио
  12. a(href="#") Контакты
  13.  
  14. Sass:
  15. $w: 40px
  16. $h: 4px
  17.  
  18. .toggle-menu
  19. background-color: transparent
  20. outline: 0
  21. width: 60px
  22. height: 60px
  23. right: 30px
  24. position: fixed
  25. z-index: 200
  26. border: none
  27. span
  28. display: block
  29.  
  30. .sandwich
  31. width: $w
  32. height: $w
  33. position: absolute
  34. top: 13px
  35. bottom: 0
  36. left: 0
  37. right: 0
  38. margin: auto
  39.  
  40. .sw-topper
  41. position: relative
  42. top: 0
  43. width: $w
  44. height: $h
  45. background: rgb(255, 255, 255)
  46. border: none
  47. border-radius: 4px 4px 4px 4px
  48. transition: transform 0.5s, top 0.2s
  49. /*transition-delay: 0.2s, 0s */
  50.  
  51.  
  52. .sw-bottom
  53. position: relative
  54. width: $w
  55. height: $h
  56. top: $h * 2
  57. background: rgb(255, 255, 255)
  58. border: none
  59. border-radius: 4px 4px 4px 4px
  60. transition: transform 0.5s, top 0.2s
  61. /*transition-delay: 0.2s, 0s */
  62.  
  63. .sw-footer
  64. position: relative
  65. width: $w
  66. height: $h
  67. top: $h * 4
  68. background: rgb(255, 255, 255)
  69. border: none
  70. border-radius: 4px 4px 4px 4px
  71. transition: transform 0.5s, top 0.2s
  72. transition-delay: 0.2s, 0s
  73.  
  74. .sandwich.active
  75. .sw-topper
  76. top: 13px
  77. transform: rotate(45deg)
  78. .sw-bottom
  79. top: 8px
  80. transform: rotate(-45deg)
  81. .sw-footer
  82. opacity: 0
  83. top: 0
  84. transform: rotate(180deg)
  85.  
  86. .main-navigation
  87. display: none
  88. position: fixed
  89. width: 100%
  90. height: 100%
  91. background-color: rgba(0,0,0,.9)
  92. z-index: 100
  93. top: 0
  94. right: 0
  95. padding-top: 180px
  96. text-align: center
  97. a
  98. display: block
  99. color: #fff
  100. text-transform: uppercase
  101. letter-spacing: 5px
  102. position: relative
  103. height: 60px
  104. &:hover
  105. color: $color
  106. span
  107. display: block
  108. position: relative
  109. top: -40px
  110. left: 0
  111. height: 100%
  112. transition: all 0.5s ease
  113. &:hover
  114. background-color: rgba(255,255,255,.08)
  115.  
  116. JQuery:
  117. $(document).ready(function () {
  118. $(".toggle-menu").click(function() {
  119. $(".sandwich").toggleClass("active");
  120. });
  121.  
  122. $(".main-navigation").click(function() {
  123. $(".main-navigation").fadeOut(600);
  124. $(".sandwich").toggleClass("active");
  125. }).append("<span>");
  126.  
  127. $(".toggle-menu").click(function() {
  128. if ($(".main-navigation").is(":visible")) {
  129. $(".main-navigation").fadeOut(600);
  130. } else {
  131. $(".main-navigation:hidden").fadeIn(600);
  132. }
  133. });
  134. });
Add Comment
Please, Sign In to add comment