I currently have a responsive toggle navigation menu which works perfectly fine. The issue I have is with the navigation icon. I'm trying to use Icon Fonts for both the open and close states. Currently my HTML is:
<a href="#menu" class="menu-link" aria-hidden="true" data-icon=""></a>
<nav id="menu" role="navigation">
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="index.html#work">work</a></li>
<li><a href="index.html#profile">profile</a></li>
<li><a href="index.html#life">life</a></li>
</ul>
</nav>
The Icon that displayes is the open (three lines) icon. I'm having trouble figuring out who I can replace that for the close state using another icon font?
Here is my current CSS for the link:
a.menu-link { float: right; display: block; font-size: 1.75em; margin-right: .75em; margin-top: 1em; }
&.active {?}
@font-face {
font-weight: normal;
font-style: normal;
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
url('../fonts/icomoon.woff') format('woff'),
url('../fonts/icomoon.ttf') format('truetype'),
url('../fonts/icomoon.svg#icomoon') format('svg');
}
[data-icon]:before {
content: attr(data-icon);
text-transform: none;
font-weight: normal;
font-variant: normal;
font-family: 'icomoon';
line-height: 1;
speak: none;
-webkit-font-smoothing: antialiased;
}
I presume i'm supposed to use an if statement? but is there a solution through the markup or CSS? If not then a JS solution would be helpful. Cheers guys!