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.

expand on icon, go to link from the first click on name

Home Forums Older releases 1.0.x expand on icon, go to link from the first click on name

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2934
    z3phir
    Participant

    hi

    i have a vertical collapsible menu and i want it to expand collapse when i click on the icon (span) works as intended

    and go to the page when i click on the name (now works only on second click)

    any idea how can i achieve this behavior ?

    this is my code

    
    var $categories_menu = $('#categories-menu');
    
    
        $categories_menu.smartmenus(
          {
          subIndicatorsText: '',
          collapsibleShowFunction: function ($ul, complete)
          {
            $ul.slideDown(200, complete);
          },
          collapsibleHideFunction: function ($ul, complete)
          {
            $ul.slideUp(200, complete);
          },
          hideOnClick: false
        });
    
        $categories_menu.smartmenus('itemActivate', $('.sm-categories a.current'));
    

    thanks in advance for any help

    #2935
    admin
    Keymaster

    Hi, you can use the following additional code:

    // don't show the sub menus in collapsible mode unless the sub arrow is clicked
    $categories_menu.on('click', 'span.sub-arrow', function(e) {
    		var obj = $categories_menu.data('smartmenus');
    		if (obj.isCollapsible()) {
    			var $item = $(this).parent(),
    				$sub = $item.parent().dataSM('sub');
    			$sub.dataSM('arrowClicked', true);
    		}
    	}).bind({
    		'beforeshow.smapi': function(e, menu) {
    			var obj = $categories_menu.data('smartmenus');
    			if (obj.isCollapsible()) {
    				var $menu = $(menu);
    				if (!$menu.dataSM('arrowClicked')) {
    					return false;
    				}
    				$menu.removeDataSM('arrowClicked');
    			}
    		}
    	});

    Let me know if you have any troubles.

    Cheers!

    #2937
    z3phir
    Participant

    thanks that worked great

    #2943
    admin
    Keymaster

    Np at all!

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