|

Quick Tip: Use an Icon with Responsive-Nav.js an Icon Font

Responsive Nav is a really nifty (and light-weight) Javascript plugin that will allow you to easily create an off-canvas navigation menu that slides down from off the screen. Here’s a quick and easy way to use an icon instead of your run of the mill plain text.

In the examples for integrating Responsive Nav into your site, you’ll find several implementations of the clickable area used to reveal the menu (called the label) including the word, “Menu” and the common menu icon (commonly known as the ‘Hamburger’ icon). However, the latter requires some extra CSS and finagling to make it work. That’s not to say it’s hard, but it could be much easier with an icon font like Font Awesome.

Simply include the Font Awesome stylesheet on your site:

Then configure responsive-nav.js using the instructions here. Once you’re ready to call the script in your webpage (right before the </body> tag, as recommended), you can use this:

This will replace the default label (‘Menu’) with some markup to call the icon below, giving you a implementation with no hassle.

Screen Shot 2013-09-12 at 4.00.53 PM

Similar Posts

  • Coding at a new level

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!This semester I am taking a class called Machine Organization and Assembly Language. What this amounts to is learning how to…

  • |

    Sass, Sublime Text, Github, and Changing my Development Workflow

    When I left the full time freelancing world 2.5ish years ago, I had a very specific way I did things and I enjoyed it; however, admittedly, it wasn’t the best. I was using Coda, not making local copies, not using any form of version control, and my frameworks were becoming stale. I’ve been going to…

  • | | |

    Favorites of 2008

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!So this may be a little late, but hey- I wanted to be sure about what I was writing; and this…

  • Cognition Media Welcomes Junes

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website!*Cross posted on Cognition Media’s Gears Blog. For those who don’t know, a few friends and I won some funding to…

  • The Dark Knight

    Note: This article was published while I was in my early 20s. I was much younger and dumber. Please don’t hold it against me. One of the perils of having a 20+ year old website! You didn’t think I’d let a movie like The Dark Knight slip through the cracks on this site, did you?…

  • |

    How to Improve Performance on Your WordPress Site

    Did you know that 80% of website visitors will abandon your website if it takes more than 5 seconds to load? That’s a lot of lost revenue and opportunities. WordPress gets a bad wrap for for being slow, but it’s not usually WordPress’ fault! If you use the right tools, you can have a nice,…

4 Comments

  1. This is a more elegant JavaScript solution than what I’ve done in the past. My only suggestion would be to use Font Awesome’s “icon-reorder” class as it displays the more common 3-line menu icon.

  2. Thanks! That is a great point; the 3-line menu is much more common.

    As a small (unrelated) addendum to this article, just a quick tip that if you float your menu items, opening the menu won’t work since you the height it technically 0. You’ll have to add the .group class or the .clearfix to fix it.

  3. Hi Joe,

    First of all: Thanks a lot for this post, it helped me a lot!

    I was wondering though if there is any way to make the Font Awesome “burger” more “tapable”. I find it very hard to open or close the reponsive nav on touch devices as you have to hit exactly one of the bars (not white space inbetween) for the nav to open/close.

    Tobi

  4. Tobi,

    Glad you liked it! I have noticed that too. I’d recommend playing with the font-size or padding to make it work a bit better.

    Joe

Comments are closed.