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: Make submenu slide open/close

Home Forums Older releases 1.0.x + Bootstrap addon Make submenu slide open/close Reply To: Make submenu slide open/close

#3443
admin
Keymaster

Yep, as you’ve noticed, by default the addon mimics Bootstrap’s default behavior so the sub menus are not animated in collapsible mode. So, you would need the following options:

collapsibleShowFunction: function($ul, complete) {
	$ul.slideDown(200, complete);
},
collapsibleHideFunction: function($ul, complete) {
	$ul.slideUp(200, function() {
		$ul.parent().removeClass('open');
		complete();
	});
}

And also another small change in “jquery.smartmenus.bootstrap.js” – comment out/remove the following code:

,
'hide.smapi': function(e, menu) {
	$(menu).parent().removeClass('open');
}

Alternatively, if you would like to avoid editing “jquery.smartmenus.bootstrap.js”, you could add the options directly in the HTML source in a data-sm-options attribute:

https://www.smartmenus.org/docs/#data-sm-options

and add the following JS code on your page after the link to “jquery.smartmenus.bootstrap.js”:

$(function() {
	$('ul.navbar-nav:not([data-sm-skip])').unbind('hide.smapi');
});

Cheers!