Guest User

Untitled

a guest
Jan 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. $(document).ready(function() {
  2. $(".icon").click(function() {
  3. $(".icon").toggleClass("active");
  4. });});
  5.  
  6. body {
  7. margin: 0;
  8. padding: 0;
  9. background: #ff5c40;
  10. }
  11.  
  12. .icon {
  13. position: absolute;
  14. top: 50%;
  15. left: 50%;
  16. transform: transition(-50%, -50%);
  17. width: 80px;
  18. height: 80px;
  19. }
  20.  
  21. .hamburger {
  22. width: 50px;
  23. height: 6px;
  24. background: #fff;
  25. position: absolute;
  26. top: 50%;
  27. left: 50%;
  28. transform: translate(-50%, -50%);
  29. box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  30. transition: .5s;
  31. }
  32.  
  33. .hamburger:before,
  34. .hamburger:after {
  35. content: "";
  36. position: absolute;
  37. width: 50px;
  38. height: 6px;
  39. background: #fff;
  40. box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  41. transition: .5s;
  42. }
  43.  
  44. .hamburger:after {
  45. top: 16px;
  46. }
  47.  
  48. .hamburger:before {
  49. top: -16px;
  50. }
  51.  
  52. .icon.active .hamburger {
  53. background: rgba(0, 0, 0, 0);
  54. box-shadow: 0 2px 5px rgba(0, 0, 0, 0);
  55. }
  56.  
  57. .icon.active .hamburger:before {
  58. top: 0px;
  59. -webkit-transform: rotate(-135deg) ;
  60. transform: rotate(-135deg);
  61. -webkit-transition: top .2s ease-in-out, -webkit-transform .3s ease-in-out .2s;
  62. transition: top .2s ease-in-out, -webkit-transform .3s ease-in-out .2s;
  63. transition: top .2s ease-in-out, transform .3s ease-in-out .2s;
  64. transition: top .2s ease-in-out, transform .3s ease-in-out .2s, -webkit-transform .3s ease-in-out .2s;
  65. }
  66.  
  67. .icon.active .hamburger:after {
  68. top: 0px;
  69. -webkit-transform: rotate(-45deg) ;
  70. transform: rotate(-45deg);
  71. transition: top .2s ease-in-out, -webkit-transform .3s ease-in-out .2s;
  72. transition: top .2s ease-in-out, transform .3s ease-in-out .2s;
  73. transition: top .2s ease-in-out, transform .3s ease-in-out .2s, -webkit-transform .3s ease-in-out .2s;
  74. }
  75.  
  76. <script
  77. src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js">
  78. </script>
  79. <div class="icon">
  80. <div class="hamburger">
  81. </div>
  82. </div>
Add Comment
Please, Sign In to add comment