Close the mobile menu after a link is tapped

In this document, we will go over how to use custom JavaScript to auto-close a menu bar while on mobile.

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

In this document, we will go over how to use custom JavaScript to auto-close a menu bar while on mobile.

Here's how that will look

Screenshot for “Auto close mobile menu”

Simply add the following JavaScript to the Layout the menu is located in. In our example, this menu is located in the Default Layout

javascript
$('.navbar .item').on("click",function(){
    $(".navbar-collapse").collapse('hide');
});

$('.nav .item.dropdown-submenu').unbind();
Screenshot for “Auto close mobile menu”

Was this page helpful?

Something wrong or missing on this page? Tell us.