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.

Reply To: accordion failed

Home Forums Older releases 1.0.x accordion failed Reply To: accordion failed

#2660
admin
Keymaster

The old v0.9.x releases used to work like an accordion in collapsible mode but, based on user feedback and UX testing (proving, for example, that it is sometimes not appropriate to auto collapse other branches since the active item might be scrolled out of view), this was changed in v1.0. Now sub menus can only be collapsed manually or when the whole tree is reset on click/tap elsewhere on the page.

You could, however, bring back the accordion behavior if you like, by adding the following API tweak on your page:

$(function() {
	$('#main-menu').bind('click.smapi', function(e, item) {
		var obj = $(this).data('smartmenus');
		if (obj.isCollapsible()) {
			var $item = $(item),
				$sub = $item.dataSM('sub');
			if ($sub && !$sub.is(':visible')) {
				obj.itemActivate($item, true);
				return false;
			}
		}
	});
});

Let me know if you have any troubles.