Menu Icon Animated
This is another example taken from the W3C Schools website on what can be done with CSS,
Click on the Menu Icon to transform it to "X":
Example Explained
HTML & CSS: We use the same styles as before, only this time, we wrap a container element around each <div> element and we specify a class name for each.
The container element is used to show a pointer symbol when the user moves the mouse over the divs (bars). When it is clicked on, it will execute a JavaScript function that adds a new class name to it, which will change the styles of each horizontal bar: the first and the last bar is transformed and rotated to the letter "x". The bar in the middle fades out and becomes invisible.
I had to rename the function as it interfered with the function in the FBM
The code for an animated hamburger
the css:
<style>
.container {
display: inline-block;
cursor: pointer;
}
.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px 0;
transition: 0.4s;
}
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-9px, 6px);
transform: rotate(-45deg) translate(-9px, 6px);
}
.change .bar2 {opacity: 0;}
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px);
transform: rotate(45deg) translate(-8px, -8px);
}
</style>
and the html:
<div class="container" onclick="myFunction1(this)"> <div class="bar1"></div> <div class="bar2"></div> <div class="bar3"></div> </div>
To get an animated icon on the page that discusses the Fixed Bottom Menu I added a new function that combined the two functions that both expanded the bottom menu and change the icon.