logo
down
shadow

Make mmenu expand to the current url


Make mmenu expand to the current url

Content Index :

Make mmenu expand to the current url
Tag : jquery , By : Stone
Date : November 24 2020, 09:00 AM

I wish this help you I approached your JS Fiddle a little differently than you originally set it up, so I hope that still works for you.
Mmenu has a configuration object called "classNames" where you can pass a class on the li that you would like to default to using the "selected" object. Here is your updated mmenu init using this setting:
$("#menu").mmenu({
    "offCanvas": {
        "zposition": "front"
    }
}, {
    classNames: {
        selected: "current-page"
    }
});
var url = window.location.href.substr(window.location.href.lastIndexOf("/") + 1);
$('#menu a').each(function(){
    var href = $(this).attr("href");
    if ( href == url ){
        $(this).parent('li').addClass('current-page');
    }
});

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

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


Tag : javascript , By : can
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
});

Can i make MMenu labels open up the submenu (not just the arrow)


Tag : development , By : FriendL
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>

How to make scrolltop() functionality work with Mmenu


Tag : jquery , By : Monev
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);
});

Tag : javascript , By : jehammon
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');
  })
})
Related Posts Related QUESTIONS :
  • Github merge multiple files into single compressed master file
  • Replace characters in a field on page load
  • Unable to send data from Form to SQL database
  • If all divs have same style, remove element
  • How to click a jQuery Dialog button in TestCafe
  • Cannot reinitialise DataTable with Angular Datatable
  • How to add Class active on Click in Navbar
  • how to call fail method into jquery.get/post success method?
  • Slider with tabs
  • Jquery Get parent element from data function
  • Ho to put a new line in <p> tag in my jquery?
  • How can I use a text value as a mathematical operator?
  • DataTable columns values showing Only DefaultContent
  • JQuery select dynamically added elements
  • How to change an image source on hover?
  • How to bind jquery event to dynamically added multiple DOM elements?
  • How to get td values and store in array using Jquery?
  • How to add handler to dinamically created tr in JQuery?
  • How to Covert Html to PDF in Jquery?
  • Jquery before() and after() used to create a <div> container not inserting closing tags in after()
  • I want to delete previously added class
  • Open html page in same window after clicking on navlink
  • Datatable is not working when I populate table using smarty
  • How to change image based on the offset top of the content div
  • Find the index of table column with specific id
  • How to return value of $(window).resize()
  • How to optimize adding numerous elements dynamically into web page
  • Content slide down on top of page?
  • How to write if statement for when a specified option is selected in select tag in JQuery
  • HTML tags remove from textarea using jQuery
  • ShareThis not display properly when initially hidden
  • jquery - Bind datepicker event
  • How can I cause an element to move on mouse scroll using transform matrix?
  • How to add Custom summaries for autogenerated colums?
  • How to update table row with data from an array using jQuery
  • Cannot get the element in jQuery
  • How to search for two values in array at the same time?
  • Creating a floating document property control that is available in all tabs of Spotfire dashboard
  • Add a "wrapper" div tag to wrap other html div tags?
  • Reload form if I get an error when validate email
  • jQuery animate height in percentage scrolls to the top
  • How to add class for per string after comma?
  • ("ID").Value not working in ASP.net user control
  • HTML Color-picker with colors box
  • Initialize Kendo Grid grouped
  • jQuery click event triggers for all picture objects
  • addClass with the full match of id in jquery
  • Function is not called on click
  • jQuery ajax.error() for all errors except 403
  • Disable other option in same div, when first one is selected
  • How to clear input text
  • Rails Nested Forms Attributes not saving if Fields Added with jQuery
  • Jquery FancyBox target specific DIV ID?
  • jQuery table paging
  • Using Jquery UI Tab control in ASP.NET MVC
  • jQuery Datatable dynamic edit button attached to each row
  • JQUERY: Setting Active state on animated menu tabs
  • Filtering data with jquery
  • JQuery punctuation for spanish (ó, í, etc.) not working in IE8
  • Intro Bar like Stack Overflow
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com