Open and close

The plugin automatically binds a click event that opens the menu to every A element that links to the menu.

<a href="#my-menu">Open the menu</a>

Open the menu manually

Trigger the open method from the API to open the menu manually.

<script type="text/javascript">
   $(document).ready(function() {
      $("#my-menu").mmenu({
         // Options
      });
      var API = $("#my-menu").data( "mmenu" );
      
      $("#my-button").click(function() {
         API.open();
      });
   });
</script>

Close the menu

By default, the menu only closes after clicking on the still visible part of the page. The plugin also automatically binds a click event that closes the menu to every A element that links to the page.

<a href="#my-page">Close the menu</a>

Close the menu manually

Trigger the close method from the API to close the menu manually.

<script type="text/javascript">
   $(document).ready(function() {
      $("#my-menu").mmenu({
         // Options
      });
      var API = $("#my-menu").data( "mmenu" );

      $("#my-button").click(function() {
         API.close();
      });
   });
</script>

Next up:
Learn more