Have I to add classes manually (eg. has-submenu current)

Home Forums Older releases 1.0.x Have I to add classes manually (eg. has-submenu current)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3035
    ratmalwer
    Participant

    I have a general understandingproblem how to maintain classes.

    When the page is loading first time the menu gets loaded.
    Then I click a menu-item and the href sends a new request to the server.
    So my page gets loaded again with menu and content.
    How can I supply the Information about class=current and submenu?

    I modified my PHP witch generates the menu so class=current is included (that works).
    So have I to backtrace with PHP to add class=has-submenu and current to the parents?

    I think there must be an other way. Can someone point me in the right direction?

    #3048
    admin
    Keymaster

    If you use the markCurrentItem: true option, the script will automatically add the “current” class to the proper item so you won’t need to do it server-side with PHP:

    http://www.smartmenus.org/docs/#markCurrentItem

    As for the “has-submenu” class – it is automatically added to the parent items’ A elements when the script initializes the menu tree so you don’t have to worry about it.

    #3063
    ratmalwer
    Participant

    oh – yes.
    Now I see where I can define the options.

    Here an example maybe it helps some other reader:

    $(function() {
    	$('#menu').smartmenus({
    		subMenusSubOffsetX: 1,
    		subMenusSubOffsetY: -8,
    		markCurrentItem: true,
    		markCurrentTree: true
    	});
    });
    #3320
    BikerMikeR
    Participant

    When I apply the “current” class with a different link color, the subindicator arrow (css sprite) isn’t affected, it stays with the old color. Is it possible to let it have the “current” class color?

    #3374
    admin
    Keymaster

    Which theme are you using? I’d suggest customizing the colors via Codepen by editing the SASS variables – i.e. select the theme you like here:

    http://vadikom.github.io/smartmenus/src/demo/

    click ‘Customize “theme_name” on Codepen’ and then edit the color variables you like.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?