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.

How do I drop the entire menu by selecting an item from it?

Home Forums Latest release 1.1.x + Bootstrap 4 addon How do I drop the entire menu by selecting an item from it?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8302
    genivaldo
    Participant

    I would like that when selecting a menu item on the mobile platform (mobile, tablet), the entire menu would be closed, having to click the button to open it again.

    #8303
    admin
    Keymaster

    Hi, you could use something like this:

    $(function() {
      // SmartMenus jQuery - collapse mobile navbar on menu item select
      $('.navbar-nav').on('select.smapi', function(e) {
      	if ($(this).hasClass('sm-collapsible')) {
      		$('.navbar-toggler')[0].click();
      	}
      });
    });

    Just include it on your page after jQuery.

    If you have multiple navbars on your pages (not very likely), set them specific ids and replace the classes .navbar-nav and .navbar-toggler in the code above with the proper ids.

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