mmenu: Click a menu item to expand?
Tag : jquery , By : Robin Buitenhuis
Date : March 29 2020, 07:55 AM
will help you It is possible to do this with using span tags ( as seen here in the right menu on one of their demos). Give this a try: <ul>
<li><a href='Page1.aspx'>Item with no submenu</a></li>
<li>
<span>Click this to expand</span>
<ul>
<li><a href='sub1.aspx'>Submenu 1</a></li>
<li><a href='sub2.aspx'>Submenu 2</a></li>
</ul>
</li>
</ul>
|
How to make the mmenu default expanded
Date : March 29 2020, 07:55 AM
To fix this issue You can give the class ( "mm-opened" ) to the menu which have submenu. <nav id="menu">
<ul>
<li><a href="#">Home</a></li>
//MENU WITH SUBMENU ADD CLASS mm-opened
<li class="mm-opened">
<a href="#about">About us</a>
<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>
$("#menu").mmenu({
slidingSubmenus: false
});
|
Date : March 29 2020, 07:55 AM
This might help you When I make a label in MMenu, it creates a arrow on the right " > " and only that arrow opens up the submenu. I'd like to make the entire label open up the submenu, and I'm wondering how I could do that. Below is a snippet of the first label and the code. , Figured it out, just change the <a href="sock/">Socks</a>
<span>Socks</span>
|
Date : March 29 2020, 07:55 AM
I hope this helps you . Your offset variable is initialized at the loading of the page and doesn't change. That's why it's always 0. Do: $(window).scroll(function(){
var offset = $(window).scrollTop();
console.log(offset);
});
|
mmenu: expand only one submenu at a time (slidingSubmenus: false)
Date : March 29 2020, 07:55 AM
help you fix your problem I like to use mmenu: http://mmenu.frebsite.nl/ in my Web project. I should set slidingSubmenus: false but to save vertical space, I should automatically collapse the previous expanded submenu, if a new submenu is expanded - i.e. only one submenu shall be expanded at the time. These are requirements of the customer. , Since you are using jQuery, you could add some jQuery to do this: jQuery(document).ready(function(){
$('.mm-next').click(function(){
var myMenu = $(this).closest('.mm-vertical');
$('.mm-vertical').not(myMenu).removeClass('mm-opened');
})
})
|