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.

Is a possible to make second level menus appear only when hovering over the triangle pointing right

Home Forums Older releases 0.9.x Is a possible to make second level menus appear only when hovering over the triangle pointing right

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1334
    igonzalez
    Participant

    Thanks for such a great product!

    Is a possible to make second level menus appear only when hovering over the triangle pointing right?

    I found very distracting and busy showing second level menus automatically for long menus all with second levels!

    I have been looking over the API and the source code but I have not been able to figure it out.

    Any help will be appreciated

    #1615
    admin
    Keymaster

    Glad you like the script!

    It’s not too difficult to achieve – e.g.:

    var $mainMenu = $('#main-menu');
    $mainMenu.bind('activate.smapi', function(e, item) {
    		var obj = $mainMenu.data('smartmenus'),
    			$item = $(item),
    			$sub = $item.parent().dataSM('sub'),
    			level = $sub ? $sub.dataSM('level') : -1;
    		if (!obj.isTouchMode() && level > 2 && !$item.dataSM('arrow-activated')) {
    			return false;
    		}
    		// unflag
    		$item.removeDataSM('arrow-activated');
    	})
    	.delegate('span.sub-arrow', 'mouseenter', function(e) {
    		var obj = $mainMenu.data('smartmenus'),
    			$item = $(this).parent(),
    			$sub = $item.parent().dataSM('sub'),
    			level = $sub ? $sub.dataSM('level') : -1;
    		if (!obj.isTouchMode() && level > 2) {
    			// flag it so that we don't cancel the event on activate.smapi
    			$item.dataSM('arrow-activated', true);
    			$mainMenu.smartmenus('itemActivate', $item);
    		}
    	});

    However, I am not sure it would be intuitive to use. I guess most users will simply click on the items if the sub menu doesn’t appear immediately on hover and will not think about hovering the sub indicator arrow instead.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.