I am working on an HTML button with the following code:
<button id="sidebar-toggle-button" class="btn btn-primary header-btn" type="button" data-bs-toggle="offcanvas"
data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
<div class="icons">
<i id="sidebar-toggle-default" class="fa-solid fa-bars sidebar-toggle-icon-default"></i>
<i id="sidebar-toggle-active" class="fa-solid fa-bars-staggered sidebar-toggle-icon-active"></i>
</div>
</button>
This button is part of a collapsible sidebar created using Bootstrap (known as an offcanvas). I want to create a hover effect where the
"sidebar-toggle-default"
icon transitions to the "sidebar-toggle-active"
icon.
After researching, I found a discussion suggesting this can be achieved with CSS. However, the examples I found are too complex for my needs, and I am unable to replicate them successfully in my own code.
My goal is to create a simple animation where the default icon shows three bars stacked vertically, and the "active" icon displays the same bars with a slight offset in the middle one. When hovering over the icons, I want it to look like the middle bar is being pushed forward. Is there a straightforward way to achieve this effect?