Main Menu closes on mouse out even when show/hideOnClick is set to true

Home Forums Older releases 0.9.x Main Menu closes on mouse out even when show/hideOnClick is set to true

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1405
    drastick
    Participant

    Check out the follow example. When you click to open a menu and then hover over a sibling menu item the previous menu closes and if you hover over another menu it opens on hover and not click. I think if showOnClick is set to true then hovering over a sibling menu when one is currently open it should do nothing.

    http://jsfiddle.net/ubup3qvt/

    I think modifying the itemEnter method as I have below is a decent way to achieve this.

    Thoughts?

    itemEnter: function(e) {
    	var $a = $(e.currentTarget);
    	if (!this.handleItemEvents($a)) {
    		return;
    	}
    	if (!this.isTouchMode() && (!this.opts.showOnClick || $a.parent().parent().dataSM('level') > 1)) {
    		if (this.showTimeout) {
    			clearTimeout(this.showTimeout);
    			this.showTimeout = 0;
    		}
    		var self = this;
    		this.showTimeout = setTimeout(function() { self.itemActivate($a); }, this.opts.showTimeout);
    	}
    	this.$root.triggerHandler('mouseenter.smapi', $a[0]);
    },
    #1752
    admin
    Keymaster

    Thanks very much for your input (saw your pull request on GitHub too)!

    However, currently when showOnClick is set to true, the menu tree behaves like desktop menus – i.e. a click activates the main menu items and after that their sub menus appear immediately on hover. The idea is that this makes sense for someone who wants to use the script for some kind of app that mimics desktop apps. So at least for now, I don’t plan to implement this change. I may think of introducing some new option in the future that would allow to change the behavior.

    Thanks again!

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?