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.

Collapse mobile menu parent click

Home Forums Older releases 0.9.x Collapse mobile menu parent click

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1366
    shub
    Participant

    I am using the Smartmenus Bootstrap 3 plugin. All works good besides the collapse mobile menu. If I click on a parent item that has subitems always the list of the children items will be expanded.
    But how can I adjust the code so only the subitems will be displayed if I click on the associated arrow on the parent item? Same functionality of the standard smartmenus.

    Thanks for your help in advance!

    #1663
    admin
    Keymaster

    Actually, the standard SmartMenus behavior is to expand the sub menu on first click (or tap) on the parent item and to activate the item link on second click. But for the Bootstrap add-on we have copied Bootstrap’s default behavior which is to just expand/collapse the sub menus and never activate the parent item link (it’s only possible via the context menu).

    But anyway, to get the default SmartMenus behavior you will need to edit “jquery.smartmenus.bootstrap.js” and delete/comment out the following code:

    ,
    // click the parent item to toggle the sub menus (and reset deeper levels and other branches on click)
    'click.smapi': function(e, item) {
    	var obj = $(this).data('smartmenus');
    	if (obj.isCollapsible()) {
                    var $item = $(item),
                    	$sub = $item.parent().dataSM('sub');
                    if ($sub && $sub.dataSM('shown-before') && $sub.is(':visible')) {
                    	obj.itemActivate($item);
                    	obj.menuHide($sub);
                    	return false;
                    }
    	}
    }
    #1718
    ccml
    Participant

    Hi, does this method still work? I seem to be having problems implementing it.

    Thanks.

    #1721
    admin
    Keymaster

    Hi, I just tested with v0.9.7 and it works. This restores the default behavior of the script – the first click/tap on the parent item shows its sub menu, the second activates the link.

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