Var not defined (responsive-nav)

310 Views Asked by At

I’m using a responsive nav plug-in (responsive-nav.com) and have done for many projects. I love it and it works perfectly. I’ve started using CodeKit which checks javascript before it’s saved and it’s throwing up an error even though the plug-in works on the page. I’m more design/html/css so I just wanted to check i there’s another way to write/call the plug-in. Currently I use this:

$(function(){
   var navigation = responsiveNav(".site-nav__list", {
        insert: "before",
        customToggle: ".site-nav__toggle"
    });
});

I think this is correct from the documentation but I get the following 2 alerts/errors;

‘navigation’ is defined but never used. — column 9 ‘responsiveNav’ is not defined. — column 22

I (think I) understand what this means but wondered if there was another way of writing the code? I don’t know how to adapt this so it doesn’t use a variable. I tried this instead:

$(function(){
    $(".site-nav__list").responsiveNav({
        customToggle: ".site-nav__toggle"
    });
})

Which returned no errors but then the plug-in stopped working. Looks pretty standard to be though?

Thanks, hope someone can shed some light on this.

0

There are 0 best solutions below