Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <div class="toggle_btn">
  2. <span class="sandwich">
  3. <span class="sw-topper"></span>
  4. <span class="sw-bottom"></span>
  5. <span class="sw-footer"></span>
  6. </span>
  7. </div>
  8.  
  9. main.css ---------------------------------
  10. .toggle_btn {
  11. display: none;
  12. height: 30px;
  13. width: 30px;
  14. position: absolute;
  15. z-index: 200;
  16. top: 22px;
  17. right: 25%;
  18. left: auto;
  19. background-color: #00899d;
  20. -webkit-border-radius: 3px;
  21. -moz-border-radius: 3px;
  22. -ms-border-radius: 3px;
  23. -o-border-radius: 3px;
  24. border-radius: 3px;
  25. }
  26. .toggle_btn .sandwich {
  27. width: 30px;
  28. height: 30px;
  29. position: absolute;
  30. top: 0;
  31. bottom: 0;
  32. left: 0;
  33. right: 0;
  34. margin: auto;
  35. }
  36. .toggle_btn .sandwich span {
  37. height: 2px;
  38. width: 24px;
  39. position: relative;
  40. border-radius: 2px;
  41. left: 3px;
  42. background-color: #fff;
  43. display: block;
  44. }
  45. .toggle_btn .sandwich span.sw-topper {
  46. top: 6px;
  47. transition: transform 0.3s, top 0.2s;
  48. }
  49. .toggle_btn .sandwich span.sw-bottom {
  50. top: 12px;
  51. transition: transform 0.3s, top 0.2s;
  52. transition-delay: 0.1s, 0s;
  53. }
  54. .toggle_btn .sandwich span.sw-footer {
  55. top: 18px;
  56. transition: all 0.5s;
  57. transition-delay: 0.1s;
  58. }
  59. .toggle_btn .sandwich.active .sw-topper {
  60. top: 15px;
  61. -moz-transform: rotate(-45deg);
  62. transform: rotate(-45deg);
  63. }
  64. .toggle_btn .sandwich.active .sw-bottom {
  65. top: 13px;
  66. -moz-transform: rotate(45deg);
  67. transform: rotate(45deg);
  68. }
  69. .toggle_btn .sandwich.active .sw-footer {
  70. opacity: 0;
  71. top: 0;
  72. transform: rotate(180deg);
  73. }
  74.  
  75. media.css ===================
  76. .toggle_btn {
  77. display: block;
  78. }
  79.  
  80. js ========================
  81. $('.toggle_btn').click(function(){
  82. $(".sandwich").toggleClass("active");
  83. if($('.menu').is(':visible')) {
  84. $('.menu').slideUp(300);
  85. } else {
  86. $('.menu').slideDown(300);
  87. };
  88. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement