partiz
partiz

Reputation: 1216

Is it possible to open submenu in jQuery mmenu?

<nav id="menu2">
    <ul>
        <li><a href="#/">Home</a>
            <ul>
                <li><a href="#/">h1</a></li>
                <li><a href="#/">h2</a></li>
                <li><a href="#/">h3</a></li>
                <li><a href="#/">h4</a></li>
                <li><a href="#/">h5</a></li>
            </ul>
        </li>
        <li><a href="#/">History</a></li>
        <li><a href="#/">The team</a></li>
        <li><a href="#/">Our address</a></li>
        <li><a href="#/">Contact</a></li>
    </ul>
</nav>

I want show 'home' submneu when I click a link like this:

<a id="home">open home menu</a>

also I could navigate parents and it childs..

Is it possible?

DEMO: http://jsfiddle.net/yhta5ux7/8/ when I click on menu1, it opens root menus. I want open home menu by default. (I want open root menu by 'mwnu1' link and home menu by 'open home' link. I hope you got my mean.

Upvotes: 0

Views: 1442

Answers (1)

tRx
tRx

Reputation: 813

On the official mmenu page:

Open submenus Click the entire menu item to open a submenu.

The plugin assumes every A element in the menu should be clickable and therefor adds the link to open a submenu next to them. If you replace the A with a SPAN, the entire menu item becomes clickable:

<nav id="my-menu">
   <ul>
      <li><a href="/">Home</a></li>
      <li><span>About us</span>
         <ul>
            <li><a href="/about/history">History</a></li>
            <li><a href="/about/team">The team</a></li>
            <li><a href="/about/address">Our address</a></li>
         </ul>
      </li>
      <li><a href="/contact">Contact</a></li>
   </ul>
</nav>

mmenu tips and tricks

Upvotes: 1

Related Questions