Reply To: Close sub menu when hitting TAB

Home Forums Older releases 0.9.x Close sub menu when hitting TAB Reply To: Close sub menu when hitting TAB

#2412
admin
Keymaster

OK, here are quick instructions for v0.9.7:

1) In “sm-core-css.css” replace the following line:

ul.sm ul{position:absolute;top:-999999px;width:100px;}

with the following:

ul.sm ul{display:none;position:absolute;}

2) In “jquery.smartmenus.js” replace the following:

(!this.isTouchMode() ||

with the following:

this.focusActivated && (!this.isTouchMode() ||

3) In “jquery.smartmenus.js” replace all occurrences of the following:

this.clickActivated = false;

with the following:

this.clickActivated = false;
this.focusActivated = false;

4) In “jquery.smartmenus.js” find the current “itemClick” method and replace it with the following:

			itemClick: function(e) {
				if (this.isTouchScrolling) {
					this.isTouchScrolling = false;
					e.stopPropagation();
					return false;
				}
				var $a = $(e.currentTarget);
				if (!this.handleItemEvents($a)) {
					return;
				}
				$a.removeDataSM('mousedown');
				if (this.$root.triggerHandler('click.smapi', $a[0]) === false) {
					return false;
				}
				// undo fix: prevent the address bar on iPhone from sliding down when expanding a sub menu
				if ($a.dataSM('href')) {
					$a.attr('href', $a.dataSM('href')).removeDataSM('href');
				}
				var $sub = $a.parent().dataSM('sub');
				// if the sub is not visible
				if ($sub && (!$sub.dataSM('shown-before') || !$sub.is(':visible'))) {
					// try to activate the item and show the sub
					this.itemActivate($a);
					// if "itemActivate" showed the sub, prevent the click so that the link is not loaded
					// if it couldn't show it, then the sub menus are disabled with an !important declaration (e.g. via mobile styles) so let the link get loaded
					if ($sub.is(':visible')) {
						this.focusActivated = true;
						return false;
					}
				} else if (this.opts.showOnClick && $a.parent().parent().dataSM('level') == 1 && $sub) {
					this.clickActivated = true;
					this.menuShow($sub);
					return false;
				}
				if ($a.hasClass('disabled')) {
					return false;
				}
				if (this.$root.triggerHandler('select.smapi', $a[0]) === false) {
					return false;
				}
			},

Cheers!

Register

You will be emailed a link to set your password.

Login

Lost password?