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.

Re: Collapse mobile menu on menu click

Home Forums Older releases 0.9.x Collapse mobile menu on menu click Re: Collapse mobile menu on menu click

#1673
admin
Keymaster

You can achieve it like this – open “jquery.smartmenus.bootstrap.js” and find the following lines:

			.bind({
				// set/unset proper Bootstrap classes for some menu elements
				...

Then change them like this:

			.bind({
				'select.smapi': function(e, item) {
					var $this = $(this),
						obj = $this.data('smartmenus');
					if (obj.isCollapsible()) {
						$this.closest('.navbar').find('button.navbar-toggle').click();
					}
				},
				// set/unset proper Bootstrap classes for some menu elements
				...

This will make sure each time a menu item is selected a click is simulated on the navbar toggle button which would collapse the navbar.