Guest User

Untitled

a guest
Jan 17th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <!-- CSS Animated Sandwich Icon (HTML) -->
  2.  
  3. <div id="sandwich">
  4. <div class="sw-topper"></div>
  5. <div class="sw-bottom"></div>
  6. <div class="sw-footer"></div>
  7. </div>
  8.  
  9. /* CSS Animated Sandwich Icon (CSS) */
  10.  
  11. body {background-color: #333;}
  12.  
  13. $w = 100px
  14. $h = 10px
  15.  
  16. #sandwich
  17. width $w
  18. height $w
  19. position: absolute;
  20. top:0;
  21. bottom: 0;
  22. left: 0;
  23. right: 0;
  24. margin: auto;
  25.  
  26. .sw-topper
  27. position: relative
  28. top: 0
  29. width $w
  30. height $h
  31. background: rgb(255, 255, 255);
  32. border: none;
  33. border-radius: 4px 4px 4px 4px;
  34. transition: transform 0.5s, top 0.2s;
  35.  
  36. /* transition-delay: 0.2s, 0s; */
  37.  
  38. .sw-bottom
  39. position: relative
  40. width $w
  41. height $h
  42. top @height * 2
  43.  
  44. background: rgb(255, 255, 255);
  45. border: none;
  46. border-radius: 4px 4px 4px 4px;
  47. transition: transform 0.5s, top 0.2s;
  48. transition-delay: 0.2s, 0s;
  49.  
  50. .sw-footer
  51. position: relative
  52. width $w
  53. height $h
  54. top @height * 4
  55. background: rgb(255, 255, 255);
  56. border: none;
  57. border-radius: 4px 4px 4px 4px;
  58. transition: all 0.5s;
  59. transition-delay: 0.1s;
  60.  
  61. #sandwich.active
  62. .sw-topper
  63. top: 15px;
  64. transform: rotate(140deg);
  65. .sw-bottom
  66. top: 5px;
  67. transform: rotate(-140deg);
  68. .sw-footer
  69. opacity: 0;
  70. top: 0;
  71. transform: rotate(180deg);
  72.  
  73. /* CSS Animated Sandwich Icon (JS) */
  74.  
  75. $("#sandwich, .menu_item").click(function() {
  76. $("#sandwich").toggleClass("active");
  77. });
Add Comment
Please, Sign In to add comment