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

#3090
admin
Keymaster

There you go:

// deactivate item's sub on Space if it's activated
$.SmartMenus.prototype.old_rootKeyDown = $.SmartMenus.prototype.rootKeyDown;
$.SmartMenus.prototype.rootKeyDown = function(e) {
	if (!this.handleEvents()) {
		return;
	}
	if (this.isCollapsible()) {
		if (e.keyCode == 32) {
			var $target = $(e.target);
			if ($target.is('a') && this.handleItemEvents($target)) {
				var $sub = $target.dataSM('sub');
				if ($sub && $sub.is(':visible')) {
					this.menuHide($sub);
					e.preventDefault();
					return;
				}
			}
		}
	}
	this.old_rootKeyDown(e);
};

This replaces the default rootKeyDown method so just include it on your page after the script core “jquery.smartmenus.js”.

Register

You will be emailed a link to set your password.

Login

Lost password?