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.

mbasil

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: accordion failed #2664
    mbasil
    Participant

    I am using code for having links on each li. Comparing the code you wrote found that the misfuction was at obj.itemActivate($item); By adding the true flag works fine!

    So my code is:

    var $mainMenu = $('#main-menu').on('click', 'span.sub-arrow', function(e) {
    		// toggle the sub menu on sub arrow click in collapsible mode
    		var obj = $mainMenu.data('smartmenus');
    		if (obj.isCollapsible()) {
    			var $item = $(this).parent(),
    				$sub = $item.parent().dataSM('sub'),
    				subIsVisible = $sub.dataSM('shown-before') && $sub.is(':visible');
    			$sub.dataSM('arrowClicked', true);
    			//$('#main-menu').smartmenus('menuHideAll');
    			obj.itemActivate($item,true);
    			if (subIsVisible) {
    				obj.menuHide($sub);
    			}
    			
    			e.stopPropagation();
    			e.preventDefault();
    		}
    	}).bind({
    		// don't show the sub menu in collapsible mode unless the sub arrow is clicked
    		'beforeshow.smapi': function(e, menu) {
    			var obj = $mainMenu.data('smartmenus');
    			if (obj.isCollapsible()) {
    				var $menu = $(menu);
    				if (!$menu.dataSM('arrowClicked')) {
    					return false;
    				}
    				$menu.removeDataSM('arrowClicked');
    			}
    		},
    		'show.smapi': function(e, menu) {
    			$(menu).dataSM('parent-a').children('span.sub-arrow').text('-');
    		},
    		'hide.smapi': function(e, menu) {
    			$(menu).dataSM('parent-a').children('span.sub-arrow').text('+');
    		}
    )};

    Thanks very much for your time

Viewing 1 post (of 1 total)