How to link a button to open the hamburger menu (desktop)?

Question:
Is there a (simple) way to link a button to open the hamburger menu (desktop)? I don’t have that choice to link to the menu when trying to add a link to my button.

Already searched the web to no avail.

Product:
Wix Studio

What are you trying to achieve:
Besides having the hamburger menu open on click, I want to link a button on a page to open the menu as well. Basically it’s for a map that I want to have under the menu that gets linked to a section on the page (via a button).

Additional information:
Don’t want to use a lightbox for the map, thinking it would be nice to use the sliding out menu for it.

  • The ID of your custom button is #openMenuButton.
  • The ID of the hamburger menu button is #hamburgerMenuButton.
  • The ID of the target section is #targetSection.

Here’s how you can implement this:

  1. Assign IDs:
  • Ensure the custom button has the ID #openMenuButton.
  • Ensure the hamburger menu button has the ID #hamburgerMenuButton.
  • Ensure the target section has the ID #targetSection.
  1. Add the following code to your site’s code:
$w.onReady(function () {
    // Add click event to the custom button
    $w("#openMenuButton").onClick(() => {
        // Trigger click event on the hamburger menu button to open the menu
        $w("#hamburgerMenuButton").click();

        // Navigate to the target section
        $w("#targetSection").scrollTo();
    });
});

Tell if its works for you.