Reply To: Hide submenu of clicked menu item only

Home Forums Older releases 1.0.x Hide submenu of clicked menu item only Reply To: Hide submenu of clicked menu item only

#2714
admin
Keymaster

Hi,

To make the whole parent item just a toggle button for its sub menu in collapsible mode, you could use additionally something like this:

$(function() {
	// use the whole parent item as sub menu toggle button
	$('#main-menu').bind('click.smapi', function(e, item) {
		var obj = $(this).data('smartmenus');
		if (obj.isCollapsible()) {
			var $sub = $(item).dataSM('sub');
			if ($sub && $sub.is(':visible')) {
				obj.menuHide($sub);
				return false;
			}
		}
	});
});

As you have noticed, by default the script has a slightly different behavior for parent items in collapsible mode – the first click/tap on them, expands the sub menu, the second click/tap activates the item’s link (and collapses the sub menu since by default the hideOnClick: true option is used). Of course, at any time the sub menu indicator +/- button can also be used as toggle for the sub menu. This allows setting a link that can be activated to parent items, which is not possible in your case.

Register

You will be emailed a link to set your password.

Login

Lost password?