Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

Two navbars, apply to one, ignore the other...

Home Forums Older releases 0.9.x Two navbars, apply to one, ignore the other...

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2286
    ecommunities
    Participant

    I use navbars for both standard hover based menus, as well as fat-footer always visible menus, but the problem is that SM is applying itself to both dispite me only using the “sm” class on the hover menu, and intentionally leaving it off of the always visible menu.

    No matter what I do I can’t seem to stop SM from applying itself to every navbar on the page. How do I accomplish this so I can leave the fat footer always visible menu untouched?

    Appreciate your help!

    Kevin.

    #2287
    ecommunities
    Participant

    I should add, that this is a “Bootstrap 3” navbar. The site says it’s Zero Config, so I’m guessing that the “sm” class as equally zero effect.

    #2288
    ecommunities
    Participant

    Ok, sometimes it takes filing a support request to empty your head so you can find the problem….

    I finally noticed your note at the end of the Bootstrap specific page…

    The default options used in jquery.smartmenus.bootstrap.js should work well for all. However, you can, of course, tweak them if you like.

    I altered the starting lines like so…

    
    $('ul.navbar-nav.sm').each(function() {    // <- added the '.sm'
    	var $this = $(this);
    	$this.smartmenus({                // <- removed the '.addClass('sm')'
                ...
            });
    });
    

    While it was a simple fix, it’s a bit of a PITA to have to change this every time you update your codebase, would have preferred this to be some form of call time param.

    Anyhow, thanks for a great piece of code!

    Cheers,

    Kevin.

    #2291
    admin
    Keymaster

    Yep, at the moment by default the script will automatically work for all navbars on the page. But I like your suggestion and I will consider adding the possibility to easily skip any navbar – e.g. could be something like this in the JS:

     $('ul.navbar-nav:not([data-smartmenus-skip])').each(function() {  ...

    and this in the HTML:

    <ul class="nav navbar-nav" data-smartmenus-skip="true">...

    So that modifying the default “jquery.smartmenus.bootstrap.js” wouldn’t be required like now.

    Cheers!

    #2292
    ecommunities
    Participant

    Great idea, just shorten the tag to ‘sm-skip’ and you’re golden 🙂 Keeps the prefix inline with your current class nomenclature, is a little less verbose, and still gets the point across. Big fan of data attributes, so this seems like the logical choice.

    Thanks, and Cheers!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.