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.

Re: How to disable/enable only one sub menu?

Home Forums Older releases 0.9.x How to disable/enable only one sub menu? Re: How to disable/enable only one sub menu?

#1696
admin
Keymaster

OK, there is no available method for this, but you could achieve it, for example, with some custom functions like these:

function disableItem($parentLI) {
	$parentLI.on('mouseenter.smartmenus mouseleave.smartmenus mousedown.smartmenus focus.smartmenus blur.smartmenus click.smartmenus touchend.smartmenus', 'a', function(e) {
		e.stopPropagation();
		e.preventDefault();
	});
}

function enableItem($parentLI) {
	$parentLI.off('mouseenter.smartmenus mouseleave.smartmenus mousedown.smartmenus focus.smartmenus blur.smartmenus click.smartmenus touchend.smartmenus');
}

When calling any of these you will need to pass the item’s LI element as an argument. For example, if you have the following HTML:

...
<li id="myParentItem"><a>Menu 2 </a>
	<ul>...</ul>
</li>
...

you could use the following JS to disable/enable the item (and its sub menu):

disableItem($('#myParentItem'));
enableItem($('#myParentItem'));