Hamburger Menu Hover Effect #2

HTML
<button><span></span></button>
CSS
html, body { height: 100%; width: 100%; margin: 0; } body { display: flex; align-items: center; background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%); } button { width: 30px; height: 20px; position: relative; background: none; border: none; padding: 0; display: block; margin: 0 auto; cursor: pointer; outline: none; } button span { width: 100%; height: 3px; background: #fff; display: block; margin: 0; border-radius: 100px; position: relative; left: -10px; transition: 0.2s cubic-bezier(1, -0.46, 0, 1.4); } button span::before { content: ""; width: 100%; height: 3px; background: #fff; display: block; position: absolute; top: -200%; border-radius: 100px; left: 10px; transition: 0.2s cubic-bezier(1, -0.46, 0, 1.4); } button span::after { content: ""; width: 100%; height: 3px; background: #fff; display: block; position: absolute; bottom: -200%; border-radius: 100px; right: -5px; transition: 0.2s cubic-bezier(1, -0.46, 0, 1.4); } button:hover span { left: 5px; transition: 0.4s cubic-bezier(1, -0.46, 0, 1.4); } button:hover span::before { left: 0; transition: 0.4s cubic-bezier(1, -0.46, 0, 1.4); } button:hover span::after { right: 0; transition: 0.4s cubic-bezier(1, -0.46, 0, 1.4); } .button-toggled span { left: 5px; background: transparent; top: 5px; transition: 0.3s cubic-bezier(1, -0.46, 0, 1.4) !important; } .button-toggled span::before { left: 0; transform-origin: center-left; transform: rotate(-45deg); bottom: 5px; transition: 0.3s cubic-bezier(1, -0.46, 0, 1.4) !important; } .button-toggled span::after { right: 0; transform-origin: center-right; transform: rotate(45deg); top: -5px; transition: 0.3s cubic-bezier(1, -0.46, 0, 1.4) !important; } .button-toggled:hover span { left: 5px; } .button-toggled:hover span::before { left: 0; } .button-toggled:hover span::after { left: 0; }
JAVASCRIPT
$(document).ready(function(){ $("button").click(function(){ $("button").toggleClass("button-toggled") console.log('click'); }); });
Expand for more options Login