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.

jimbob

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • jimbob
    Participant

    Its crazy.
    Searching 2 days for a solution of this problem and found it 5 minutes after posting in this forum.

    Here is the solution:

    
    
    $(function() {
    		$('#main-menu').smartmenus({
    			mainMenuSubOffsetX: 1,
    			mainMenuSubOffsetY: -8,
    			markCurrentItem: true,
    		markCurrentTree: true,
    		hideOnClick: false
    		});
    $("#main-menu").smartmenus("itemActivate", $("#main-menu").find("a.current").eq( - 1));
    	
    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);
    			obj.itemActivate($item);
    			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('+');
    		}
    	});
    
    
    
    });
    
    

    Greetings
    jimbob

    in reply to: Dynamic submenu width #2753
    jimbob
    Participant

    Hi admin,

    thank you very much for sharing the code.
    It help me alot.

    Greetings
    Jimbob

    in reply to: Mega Menu - Full Width of Parent Element? #2595
    jimbob
    Participant

    Just enhance the second css with “height ….” and you will get a wonderful, wonderful mega menu in smartmenu. The height is unfortunately fixed in this solution. Got no solution for a variable height, depending on the number of menu items – maybe someone else :o) .

    #main-menu > li {
    position:static !important;

    }
    #main-menu > li > ul {
    margin-left:0 !important;
    right:0 !important;
    width:auto !important;
    max-width:none !important;

    height: 100px;
    -webkit-column-count: 6;/*6= number of columns you like to have in your mega menu*/
    -moz-column-count:6;
    column-count: 6;
    }

Viewing 3 posts - 1 through 3 (of 3 total)