In this code snippet, the hamburger menu icon transforms into the sidebar navigation menu on click and on clicking the x icon on the menu it collapses back to a hamburger menu.
If you are having trouble with the pen, try the archived copy on GitHub
Hamburger Menu to Sidebar Menu Snippet
See the Pen Expanding and Collapsing Hamburger Menu by Jon Wilcox (@jonwilcox) on CodePen.0