MultiLevelPushMenu jQuery Plugin implementation

Overview

Multi-level-push-menu

by Momcilo Dzunic

This jQuery plugin is inspired by Codrops MultiLevelPushMenu but unlike it not relaying on CSS 3D Transforms and therefore functional in older browsers too (i.e. IE 8).

Documentation, examples and code samples http://multi-level-push-menu.dzunic.net

Features

  • Multi-level menu support
  • Endless nesting of navigation elements
  • Expand/Collapse navigation with a left/right swipe gesture
  • Push/Slide DOM elements of choice
  • Left-to-right and Right-to-left sliding directions
  • Flexible, simple markup
  • JS Array input, if markup is not present
  • A number of exposed Options, Methods and Events
  • Cross-browser compatibility (IE8+, Chrome, Midori, Firefox, Safari, Opera, Android Browser, iOS Safari)

Usage

####Include the CSS multilevelpushmenu.css can be modified to fit website design

FontAwesome (icons)

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.min.css">

Font I like (use any other you like)

<link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,300italic,700&subset=latin,cyrillic-ext,latin-ext,cyrillic' rel='stylesheet' type='text/css'>

Multi-Level-Push-Menu

<link rel="stylesheet" href="multilevelpushmenu.css" />

####Include the JS

jQuery

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Modernizr (needed for IE8)

<script type="text/javascript" src="//oss.maxcdn.com/libs/modernizr/2.6.2/modernizr.min.js"></script>

Multi-Level-Push-Menu

<script src="jquery.multilevelpushmenu.min.js"></script>

####Menu Markup

<div id="menu">
  <nav>
    <h2><i class="fa fa-reorder"></i>All Categories</h2>
    <ul>
        <li>
            <a href="#"><i class="fa fa-laptop"></i>Devices</a>
            <h2><i class="fa fa-laptop"></i>Devices</h2>
            <ul>
                <li>
                    <a href="#"><i class="fa fa-phone"></i>Mobile Phones</a>
                    <h2><i class="fa fa-phone"></i>Mobile Phones</h2>
                    <ul>
                        <li>
                            <a href="#">Super Smart Phone</a>
                        </li>
                        <li>
                            <a href="#">Thin Magic Mobile</a>
                        </li>
                        <li>
                            <a href="#">Performance Crusher</a>
                        </li>
                        <li>
                            <a href="#">Futuristic Experience</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-desktop"></i>Televisions</a>
                    <h2><i class="fa fa-desktop"></i>Televisions</h2>
                    <ul>
                        <li>
                            <a href="#">Flat Super Screen</a>
                        </li>
                        <li>
                            <a href="#">Gigantic LED</a>
                        </li>
                        <li>
                            <a href="#">Power Eater</a>
                        </li>
                        <li>
                            <a href="#">3D Experience</a>
                        </li>
                        <li>
                            <a href="#">Classic Comfort</a>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#"><i class="fa fa-camera-retro"></i>Cameras</a>
                    <h2><i class="fa fa-camera-retro"></i>Cameras</h2>
                    <ul>
                        <li>
                            <a href="#">Smart Shot</a>
                        </li>
                        <li>
                            <a href="#">Power Shooter</a>
                        </li>
                        <li>
                            <a href="#">Easy Photo Maker</a>
                        </li>
                        <li>
                            <a href="#">Super Pixel</a>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
        <li>
            <a href="#"><i class="fa fa-book"></i>Magazines</a>
            <h2><i class="fa fa-book"></i>Magazines</h2>
            <ul>
                <li>
                    <a href="#">National Geographics</a>
                </li>
                <li>
                    <a href="#">The Spectator</a>
                </li>
                <li>
                    <a href="#">Rambler</a>
                </li>
                <li>
                    <a href="#">Physics World</a>
                </li>
                <li>
                    <a href="#">The New Scientist</a>
                </li>
            </ul>
        </li>
        <li>
            <a href="#"><i class="fa fa-shopping-cart"></i>Store</a>
            <h2><i class="fa fa-shopping-cart"></i>Store</h2>
            <ul>
                <li>
                    <a href="#"><i class="fa fa-tags"></i>Clothes</a>
                    <h2><i class="fa fa-tags"></i>Clothes</h2>
                    <ul>
                        <li>
                            <a href="#"><i class="fa fa-female"></i>Women's Clothing</a>
                            <h2><i class="fa fa-female"></i>Women's Clothing</h2>
                            <ul>
                                <li>
                                    <a href="#">Tops</a>
                                </li>
                                <li>
                                    <a href="#">Dresses</a>
                                </li>
                                <li>
                                    <a href="#">Trousers</a>
                                </li>
                                <li>
                                    <a href="#">Shoes</a>
                                </li>
                                <li>
                                    <a href="#">Sale</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-male"></i>Men's Clothing</a>
                            <h2><i class="fa fa-male"></i>Men's Clothing</h2>
                            <ul>
                                <li>
                                    <a href="#">Shirts</a>
                                </li>
                                <li>
                                    <a href="#">Trousers</a>
                                </li>
                                <li>
                                    <a href="#">Shoes</a>
                                </li>
                                <li>
                                    <a href="#">Sale</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
                <li>
                    <a href="#">Jewelry</a>
                </li>
                <li>
                    <a href="#">Music</a>
                </li>
                <li>
                    <a href="#">Grocery</a>
                </li>
            </ul>
        </li>
        <li>
            <a href="#">Collections</a>
        </li>
        <li>
            <a href="#">Credits</a>
        </li>
    </ul>
  </nav>
</div>

####Menu JS Array You can supply JS Array instead of above HTML markup.

<script>
var arrMenu = [
  {
    title: 'All Categories',
    id: 'menuID',
    icon: 'fa fa-reorder',
    items: [
      {
        name: 'Devices',
        id: 'itemID',
        icon: 'fa fa-laptop',
        link: '#',
        items: [
          {
            title: 'Devices',
            icon: 'fa fa-laptop',
            items: [
              {
                name: 'Mobile Phones',
                icon: 'fa fa-phone',
                link: '#',
                items: [
                  {
                    title: 'Mobile Phones',
                    icon: 'fa fa-phone',
                    link: '#',
                    items: [
                      {
                        name: 'Super Smart Phone',
                        link: '#'
                      },
                      {
                        name: 'Thin Magic Mobile',
                        link: '#'
                      },
                      {
                        name: 'Performance Crusher',
                        link: '#'
                      },
                      {
                        name: 'Futuristic Experience',
                        link: '#'
                      }
                    ]
                  }
                ]
              },
              {
                name: 'Televisions',
                icon: 'fa fa-desktop',
                link: '#',
                items: [
                  {
                    title: 'Televisions',
                    icon: 'fa fa-desktop',
                    link: '#',
                    items: [
                      {
                        name: 'Flat Super Screen',
                        link: '#'
                      },
                      {
                        name: 'Gigantic LED',
                        link: '#'
                      },
                      {
                        name: 'Power Eater',
                        link: '#'
                      },
                      {
                        name: '3D Experience',
                        link: '#'
                      },
                      {
                        name: 'Classic Comfort',
                        link: '#'
                      }
                    ]
                  }
                ]
              },
              {
                name: 'Cameras',
                icon: 'fa fa-camera-retro',
                link: '#',
                items: [
                  {
                    title: 'Cameras',
                    icon: 'fa fa-camera-retro',
                    link: '#',
                    items: [
                      {
                        name: 'Smart Shot',
                        link: '#'
                      },
                      {
                        name: 'Power Shooter',
                        link: '#'
                      },
                      {
                        name: 'Easy Photo Maker',
                        link: '#'
                      },
                      {
                        name: 'Super Pixel',
                        link: '#'
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        name: 'Magazines',
        icon: 'fa fa-book',
        link: '#',
        items: [
          {
            title: 'Magazines',
            icon: 'fa fa-book',
            items: [
              {
                name: 'National Geographics',
                link: '#'
              },
              {
                name: 'Scientific American',
                link: '#'
              },
              {
                name: 'The Spectator',
                link: '#'
              },
              {
                name: 'Rambler',
                link: '#'
              },
              {
                name: 'Physics World',
                link: '#'
              },
              {
                name: 'The New Scientist',
                link: '#'
              }
            ]
          }
        ]
      },
      {
        name: 'Store',
        icon: 'fa fa-shopping-cart',
        link: '#',
        items: [
          {
            title: 'Store',
            icon: 'fa fa-shopping-cart',
            items: [
              {
                name: 'Clothes',
                icon: 'fa fa-tags',
                link: '#',
                items: [
                  {
                    title: 'Clothes',
                    icon: 'fa fa-tags',
                    items: [
                      {
                        name: 'Women\'s Clothing',
                        icon: 'fa fa-female',
                        link: '#',
                        items: [
                          {
                            title: 'Women\'s Clothing',
                            icon: 'fa fa-female',
                            items: [
                              {
                                name: 'Tops',
                                link: '#'
                              },
                              {
                                name: 'Dresses',
                                link: '#'
                              },
                              {
                                name: 'Trousers',
                                link: '#'
                              },
                              {
                                name: 'Shoes',
                                link: '#'
                              },
                              {
                                name: 'Sale',
                                link: '#'
                              }
                            ]
                          }
                        ]
                      },
                      {
                        name: 'Men\'s Clothing',
                        icon: 'fa fa-male',
                        link: '#',
                        items: [
                          {
                            title: 'Men\'s Clothing',
                            icon: 'fa fa-male',
                            items: [
                              {
                                name: 'Shirts',
                                link: '#'
                              },
                              {
                                name: 'Trousers',
                                link: '#'
                              },
                              {
                                name: 'Shoes',
                                link: '#'
                              },
                              {
                                name: 'Sale',
                                link: '#'
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              },
              {
                name: 'Jewelry',
                link: '#'
              },
              {
                name: 'Music',
                link: '#'
              },
              {
                name: 'Grocery',
                link: '#'
              }
            ]
          }
        ]
      },
      {
        name: 'Collections',
        link: '#'
      },
      {
        name: 'Credits',
        link: '#'
      }
    ]
  }
];
</script>

####Initialize When HTML markup is present.

	<script>
    $(document).ready(function(){
			$('#menu').multilevelpushmenu();
		});
	</script>

When menu items are provided as JS Array.

  <script>
    $(document).ready(function(){
      $('#menu').multilevelpushmenu({
        menu: arrMenu
      });
    });
  </script>  

Full list of options is provided below.

Options

container: $( '#menu' ),                                   // Holding container.
containersToPush: [ $( '#content1' ), $( '#content2' ) ],  // Array of objects to push/slide together with menu.
collapsed: false,                                          // Initialize menu in collapsed/expanded mode
menuID: 'multilevelpushmenu',                              // ID of <nav> element.
wrapperClass: 'multilevelpushmenu_wrapper',                // Wrapper CSS class.
menuInactiveClass: 'multilevelpushmenu_inactive',          // CSS class for inactive wrappers.
menu: arrMenu,                                             // JS array of menu items (if markup not provided).
menuWidth: 0,                                              // Wrapper width (integer, '%', 'px', 'em').
menuHeight: 0,                                             // Menu height (integer, '%', 'px', 'em').
backText: 'Back',                                          // Text for 'Back' menu item.
backItemClass: 'backItemClass',                            // CSS class for back menu item.
backItemIcon: 'fa fa-angle-right',                         // FontAvesome icon used for back menu item.
groupIcon: 'fa fa-angle-left',                             // FontAvesome icon used for menu items contaning sub-items.
mode: 'overlap',                                           // Menu sliding mode: overlap/cover.
overlapWidth: 40,                                          // Width in px of menu wrappers overlap
preventItemClick: true,                                    // set to false if you do not need event callback functionality per item click
preventGroupItemClick: true,                               // set to false if you do not need event callback functionality per group item click
direction: 'ltr',                                          // set to 'rtl' for reverse sliding direction
fullCollapse: false,                                       // set to true to fully hide base level holder when collapsed
swipe: 'both'                                              // or 'touchscreen', or 'desktop', or 'none'. everything else is concidered as 'none'

Using swipe on desktops

If you will use swiping menus on desktops, mousedown bubble will be canceled and therefore any DOM object placed within menu item won't get focus when clicked. To overcome this you can use originally triggered event returned as onItemClick's first argument. Below is an example showing how to set focus on input element, http://jsfiddle.net/5rjg9/1/

$(document).ready(function () {
    $('#menu').multilevelpushmenu({
        onItemClick: function () {
            var e = arguments[0];
            if ($(e.target).prop('tagName').toLowerCase() == 'input') {
                $(e.target).focus();
                $(e.target).val('focused');
                $(e.target).unbind('blur');
                $(e.target).blur(function(){
                    $(e.target).val('blured');
                });
            }
        }
    });
});

or,

http://jsfiddle.net/c5EA4/6/

$(document).ready(function () {
    $('#menu').multilevelpushmenu({
        onMenuSwipe: function () {
            var e = arguments[0];
            if ($(e.target).prop('tagName').toLowerCase() == 'input') return false;
        }
    });
});

Alternatively, you can set swipe option to 'touchscreen' and allow swiping menus only on touch-screen enabled devices.

Full list of exposed metdods is provided below.

Methods

/**
 * Initialize menu
 */
$('#menu').multilevelpushmenu();
// or
$('#menu').multilevelpushmenu('init');

/**
 * Collapse menu
 */
// Full collapse
$('#menu').multilevelpushmenu('collapse');

// Collapse menu down to level 1 (0 level represent root level expanded)
$('#menu').multilevelpushmenu('collapse', 1);

// Collapse menu down to the level of $menuLevelObject
$('#menu').multilevelpushmenu('collapse', $menuLevelObject);

// Collapse menu down to the level of menu level object with title 'Devices' (not really recommended since there could be many menu level objects with the same title; in such cases collasing will be unsuccessful)
$('#menu').multilevelpushmenu('collapse', 'Devices');

/**
 * Expand menu
 */
// Menu expand from fully collapsed mode to level 0
$('#menu').multilevelpushmenu('expand');

// Expand menu up to the $menuLevelObject
$('#menu').multilevelpushmenu('expand', $menuLevelObject);

// Expand menu up to the menu level object with title 'Devices' (not recommended since there could be many menu level objects with the same title; in such cases expanding will be unsuccessful)
$('#menu').multilevelpushmenu('expand', 'Devices');

/**
 * Menu Expanded?
 * Check if menu level object is already expanded (returns true/false)
 */
$('#menu').multilevelpushmenu('menuexpanded', $menuLevelObject);

/**
 * Active (last expanded) menu level
 * Returns active menu level object, or false if menu is fully collapsed
 */
$('#menu').multilevelpushmenu('activemenu');

/**
 * Find menu level(s) by title
 * Provides collection of menu level objects matching provided menu title, or false if there is no match
 */
$('#menu').multilevelpushmenu('findmenusbytitle', 'Devices');
$('#menu').multilevelpushmenu('findmenusbytitle', /devices/i);

/**
 * Find menu item(s) by name
 * Provides collection of menu item objects matching provided name, or false if there is no match
 */
$( '#menu' ).multilevelpushmenu( 'finditemsbyname' , 'Devices' );
$( '#menu' ).multilevelpushmenu( 'finditemsbyname' , /devices/i );

/**
 * Find path to root of selected menu level object
 * Provides chain collection of menu level objects (root menu level object to given menu level object), or false in case of error
 */
$('#menu').multilevelpushmenu('pathtoroot', $menuLevelObject);

/**
 * Find shared path or path differences of two given menu level objects
 * Provides collection of shared menu level objects of two menu level objects if bool parameter is set to true, or collection of menu level objects representing differences if bool is false; or false if there is no match
 */
$('#menu').multilevelpushmenu('comparepaths', $menuLevelObject1, $menuLevelObject2, bool);

// Shared path collection
$('#menu').multilevelpushmenu('comparepaths', $menuLevelObject1, $menuLevelObject2, true);

// Differences collection
$('#menu').multilevelpushmenu('comparepaths', $menuLevelObject1, $menuLevelObject2, false);

/**
 * Get or Set plug-in options
 * Get (if third parameter is not set) or Set selected plug-in option
 */
// Get
$('#menu').multilevelpushmenu('option', 'mode');

// Set
$('#menu').multilevelpushmenu('option', 'mode', 'cover');

/**
 * Add/Remove menu item(s) with sub-menus
 *
 */
// Add
$('#menu').multilevelpushmenu( 'additems' , itemsArray , $addToMenu , position );

// Remove
$('#menu').multilevelpushmenu( 'removeitems' , items );

/**
 * Redraw menus
 *
 */
$('#menu').multilevelpushmenu( 'redraw' );

/**
 * Visible menus
 *
 */
$('#menu').multilevelpushmenu( 'visiblemenus' );

/**
 * Hidden menus
 *
 */
$('#menu').multilevelpushmenu( 'hiddenmenus' );

/**
 * Propagate event to underneath layer
 *
 */
 $( '#menu' ).multilevelpushmenu( 'propagateevent' , $( '#menu' ) , 'mousedown' );

Responsive menu example

$( '#menu' ).multilevelpushmenu({
    menuWidth: '20%',
    menuHeight: '100%'
});
$( window ).resize(function() {
    $( '#menu' ).multilevelpushmenu( 'redraw' );
});

Full list of events/callbacks is provided below.

Events/Callbacks

onCollapseMenuStart               // Menu collapse started
onCollapseMenuEnd                 // Menu collapse ended
onExpandMenuStart                 // Menu expand started
onExpandMenuEnd                   // Menu expand ended
onGroupItemClick                  // Click/touchstart menu item containing sub-items
onItemClick                       // Click/touchstart menu item which doesn't contain sub-items
onTitleItemClick                  // Title icon click/touchstart
onBackItemClick                   // Back item click/touchstart
onMenuReady                       // Menu created and ready for use
onMenuSwipe                       // Menu swipe initiated

Provided argument for onMenuReady, onCollapseMenuStart, onCollapseMenuEnd, onExpandMenuStart and onExpandMenuEnd callbacks is current options object.

For onMenuSwipe, onTitleItemClick and onBackItemClick callbacks provided arguments are respecively event object, menu level holder object and plug-in options object.

For onGroupItemClick and onItemClick callbacks provided arguments are respecively event object, menu level object, clicked item object and plug-in options object.

An event callback example

Each event triggers a callback; An example using onItemClick event callback functionality.

$( '#menu' ).multilevelpushmenu({
    onItemClick: function() {
        // First argument is original event object
        var event = arguments[0],
            // Second argument is menu level object containing clicked item (<div> element)
            $menuLevelHolder = arguments[1],
            // Third argument is clicked item (<li> element)
            $item = arguments[2],
            // Fourth argument is instance settings/options object
            options = arguments[3];

        // You can do some cool stuff here before
        // redirecting to href location
        // like logging the event or even
        // adding some parameters to href, etc...

        // Anchor href
        var itemHref = $item.find( 'a:first' ).attr( 'href' );
        // Redirecting the page
        location.href = itemHref;
    }
});

Browser Support / tested

  • Chrome
  • Midori
  • Firefox
  • Safari
  • IE8+
  • Opera 12.16
  • Android Browser 4.1.2
  • iOS Safari 7.0.1

License

Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php

Comments
  • Problem with menu on IPhone

    Problem with menu on IPhone

    Dear adgsm I am struggling with menu display on IPhone.

    Instead of pushing content to the right and displaying menu, content gets minimized and menu gets displayed beside my content (see screenshot below or on www.compasso.ch). This happens since I have meta tag viewport set to content="width=320"

    Do you have an idea how I can get this working?

    screenshot_iphone

    opened by suhaenni 17
  • Problem with href links

    Problem with href links

    Hi, I tried to implemented this component in my website but I don't understand why the HREF LINK doesn't work correctly. If one voice is composed by one level menu with external link (example: www.google.it), why the link doesn't work?

    Thanks.

    opened by devsoftwaresrl 13
  • Input in menu, can't get focus on it.

    Input in menu, can't get focus on it.

    Hi, it's me again ^^

    Found a problem, i put some input in the menu here is the code :

    <input class="searchable form-control" placeholder="Recherchez un flux..." data-table="flux" data-champs="title"

    name="search" type="text" value="">

    The problem is when i click on it i can't get focus, it's like random... sometimes I click 10 times for finally got it (and then my input work perfectly) sometimes it's on third ..

    Again did I miss something ? I've read your doc but didn't find mention of that.

    Thanks again for your help.

    opened by Lorithias 11
  • Object doesn't support property or method 'multilevelpushmenu'

    Object doesn't support property or method 'multilevelpushmenu'

    I keep getting this error message:

    Unhandled exception at line 223, column 9 in http://localhost:2604/ 0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'multilevelpushmenu'

    The script is loaded, I'm using v2.1.4. Was able to fix the css styling because the css file isn't called "multilevelpushmenu.css", but it's "jquery.pageslide.css".

    Can't find "multilevelpushmenu" in the javascript file either.

    I'm trying to use this in an asp.net-mvc application, in combination with jquery v2.1.4.

    opened by Yustie 9
  • IE9 : Unable to get value of the property 'match'

    IE9 : Unable to get value of the property 'match'

    Getting this error message in IE9 :

    IE9 : Unable to get value of the property 'match' : object is null or undefined jquery.multilevelpishmenu.min.js, line1, character 10553

    Any ideas what's causing this?

    opened by jnsandrew 8
  • Make the menu 100% height?  Height of window?  Not of viewport?

    Make the menu 100% height? Height of window? Not of viewport?

    I'm going to dig into the code. Thought I'd ask first. But is there a quick way to make the menu height 100% of the window and not the view port? =)

    Right now if you open the menu in a non-maximized window, the menu is only the height of the visual view port. Meaning if you maximize the window, then the menu is only the height of the last visual view port and not actually the height of the maximized window.

    Meaning it looks cut off. Only partially fills the left hand side, vertically.

    Thanks for any quick pointer. I guess I could place a background behind it, that spans 100% of the window height, but that seems a little clunky. I'd like the menu or at least background of it to span to the bottom of the page. In both maximized and non-maximized views.

    I've tried setting the height option to 100%, but doesn't seem to do the trick.

    Thanks much for help,

    opened by WriterStat 7
  • Push menu html select not working properly

    Push menu html select not working properly

    I try to add select option with in nav but it is not working as expected.

    my code is here...

     <nav>
        <div id="choice">
                <td>This is a drop-down:&nbsp;<select name="dropdown">
                    <option value="option1">Option 1</option>
                    <option value="option2">Option 2</option>
                    <option  value="option3" selected="selected">Option 3</option>
                    </select>
                </td>
            </div>
          </nav>
    
    opened by gowram 6
  • Redraw issue if menu is hidden

    Redraw issue if menu is hidden

    i create a simple example : http://jsfiddle.net/5rjg9/13/

    it works just fine, but if you resize window while the menu is collapsed (in my case the menu is hidden)), it does not open anymore, i have to refresh the page

    opened by bdbogjoe 6
  • menu button and clickable links beside

    menu button and clickable links beside

    hi, i've make a simple button instead overlapwidth: 40px. Links wich are under the .multilevelpushmenu_wrapper are not clickable beacause there is an area reserved for the menu i think. sorry for my english, but you can try to see what i say on this url : http://www.dashcam-shop.fr/mouldi/site4/

    Facebook and twitter links are not clickable. Do you have a tip to fix that ?

    thx

    opened by hedii 6
  • Adding Forms to Menu Items

    Adding Forms to Menu Items

    Is it possible to add forms with items?

    So for example you'd have an item called Chapter Title and you'd include a small form below that for a user to input and save data prior to the next item in the list. I'm using the BasicJS method right now to populate my menu.

    I'm just curious if someone has already done this with this plugin before I start adding this functionality from scratch.

    Thanks.

    opened by Coop56 5
  • The menu is conflicting with all version of Jquery

    The menu is conflicting with all version of Jquery

    Hello Everyone! The menu is conflicting with Jsquery. Can someone tell me how can I separate their funtions (I am newbie with JS)

    (There is no contact on the web page so sorry because writing this here)

    opened by gable44 5
  • [Feature Helper ]  JS Array Helper

    [Feature Helper ] JS Array Helper

    I am trying to convert parent-child related flat data to tree list data.

    Flat json data:

        {
            "name": "Devices",
            "id": 1,
            "parentId": null
        },
        {
            "name": "Mobile Phones",
            "id": 2,
            "parentId": 1
        },
        {
            "name": "Super Smart Phone",
            "id": 3,
            "parentId": 1
        },
        {
            "name": "Thin Magic Mobile",
            "id": 4,
            "parentId": 1
        },
        {
            "name": "Cameras",
            "id": 5,
            "parentId": null
        },
        {
            "name": "Smart Shot",
            "id": 6,
            "parentId": 5
        },
        {
            "name": "Power Shooter",
            "id": 7,
            "parentId": 5
        },
        {
            "name": "Easy Photo Maker",
            "id": 8,
            "parentId": 5
        }
       
    ]
    
    
    
    `function treeify(list, idAttr, parentAttr, childrenAttr) {
        if (!idAttr) idAttr = 'id';
        if (!parentAttr) parentAttr = 'parent';
        if (!childrenAttr) childrenAttr = 'children';
    
        var treeList = [];
        var lookup = {};
        list.forEach(function(obj) {
            lookup[obj[idAttr]] = obj;
            obj[childrenAttr] = [];
        });
        list.forEach(function(obj) {
            if (obj[parentAttr] != null) {
                lookup[obj[parentAttr]][childrenAttr].push(obj);
            } else {
                treeList.push(obj);
            }
        });
        return treeList;
    };
    `
    
    `var treeList = treeify(data, "id", "parentId", "items")`
    
    But I could not managed !
    Is it possible to make helper for js array ?
    Thank you.
    opened by harun 0
  • Resize menu width automatically

    Resize menu width automatically

    Hi,

    I'm experimenting, but I don't find the right solution for dynamic menu width based on a css variable. My responsive site is using a width for the menu which is >>calc(var(--bus) * 14)<<. Site recalculates "bus" (basic unit size) upon $(window).resize and menu width should be updated, menu should be redrawn. What is the right method to do so, please?

    Initial options settings works only for loading, not for resizing: $('#menu').multilevelpushmenu({ menuHeight: 'calc(var(--bus) * 14)' });

    The variable "bus" is not based on % of total width and not based on vw (width of the viewport), but it is calculated based on a space needed for my content.

    Many thanks!

    opened by mattiteve 1
  • open menu @ media query

    open menu @ media query

    Hi, I want to be able to open the menu at a certain media query but am wondering how i would achieve this. Currently using the following which is a click function to load the menu.

    new mlPushMenu(document.getElementById('mp-menu'), document.getElementById('trigger'), { type: 'cover'

    I want to be able to execute mlPushMenu <768px. As follows...

    // media query event handler if (matchMedia) { const mq = window.matchMedia("(max-width: 768px)"); mq.addListener(WidthChange); WidthChange(mq); } // media query change function WidthChange(mq) { if (mq.matches) { alert("hello im less than 768px"); // open slider menu here } }

    Can anyone advise? Thanks.

    opened by stelco 0
  • Blank menu during slide over animation

    Blank menu during slide over animation

    hi,

    It bothers me a bit that the menu goes blank during a slide over animation but not when it slides away.

    Is there a setting for removing the animation?

    opened by bingimar 1
  • move menu icon out of h2 tags and let it trigger the menu

    move menu icon out of h2 tags and let it trigger the menu

    I want to move the menu icon out of the h2 tags so I can position it where I want and add styling outside of the wrapper. Whenever it is moved outside the h2 tags it no longer triggers the menu.

    opened by alenart91 34
Releases(v2.0.1)
jQuery contextMenu plugin & polyfill

jQuery contextMenu plugin & polyfill $.contextMenu is a management facility for - you guessed it - context menus. It was designed for an application w

SWIS 2.2k Dec 29, 2022
A jQuery plugin that creates a paneled-style menu (like the type seen in the mobile versions of Facebook and Google, as well as in many native iPhone applications).

#jPanelMenu ###Version 1.4.1 jPanelMenu is a jQuery plugin for easily creating and managing off-canvas content. Check out the demo (and documentation)

Anthony Colangelo 927 Dec 14, 2022
stickUp a jQuery Plugin for sticky navigation menus.

stickUp a jQuery plugin A simple plugin that "sticks" an element to the top of the browser window while scrolling past it, always keeping it in view.

null 1.6k Dec 31, 2022
Superfish is a jQuery plugin that adds usability enhancements to existing multi-level drop-down menus.

jQuery Superfish Dropdown Menu Plugin Our favourite aquatic superhero returns from his sojourn across the galaxy infused with astonishing, hitherto un

Joel Birch 917 Dec 9, 2022
Slidebars is a jQuery Framework for Off-Canvas Menus and Sidebars into your website or web app.

Slidebars Slidebars is a jQuery Framework for Off-Canvas Menus and Sidebars into your website or web app. Version 2.0 is a complete rewrite which feat

Adam Smith 1.5k Jan 2, 2023
The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.

mmenu.js The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp. It is very customiz

Fred Heusschen 2.6k Dec 27, 2022
The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.

mmenu.js The best javascript plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp. It is very customiz

Fred Heusschen 2.6k Dec 27, 2022
This is a template project demonstrating how the MERN stack(Mongo, Express, React, Node) can be used, here we have the back end implementation and there is the React implementation as the front end

Versão em português MERN stack This is a template project demonstrating how the MERN stack(Mongo, Express, React, Node) can be used, here we have the

Douglas Samuel Gonçalves 2 Jan 22, 2022
JQuery-TableToExcel - Light weight jQuery plugin for export HTML table to excel file

tableToExcel Light weight jQuery plugin for export table to excel file Demos Website and demo here: http://tanvirpro.com/all_project/jQueryTableToExce

Tanvir Sarker 4 May 8, 2022
Jquery-cropper - A jQuery plugin wrapper for Cropper.js.

jquery-cropper A jQuery plugin wrapper for Cropper.js. Demo Main dist/ ├── jquery-cropper.js (UMD) ├── jquery-cropper.min.js (UMD, compresse

Fengyuan Chen 653 Jan 7, 2023
JQuery charCounter - jQuery Character Counter Plugin

jQuery Character Counter A jQuery based character counter for <input> and <textarea> HTML tags. What is this? This simple plugin allows you to add a c

mmmm_lemon 1 Aug 10, 2022
Jquery.iocurve - jQuery plugin like Tone Curve on Photoshop or GIMP

jquery.iocurve jQuery plugin like Tone Curve on Photoshop or GIMP. See Official page for more information. Quick start Create HTML and open in your br

null 5 Jul 28, 2022
jQuery quick notification plugin. jQuery плагин быстрых уведомлений

Note: English translation by Google Translate Notific About Description: this is a jQuery plugin that helps you display notifications on your site. Li

Webarion 2 Nov 7, 2021
A JQuery Implementation of David Walsh's MooTools scrollspy

jquery-scrollspy This library is no longer actively supported or maintained. For similar functionality checkout these other libraries: https://github.

Sam Alexander 443 Dec 13, 2022
A jsPlumb-based tree chart implementation for jQuery.

jsPlumbTree A jQuery plugin for generating a tree structure using jsPlumb. The tree is drawn from left to right, top to bottom. Please note that only

Daniele Ricci 4 Jul 27, 2022
Dependency-free implementation of zoom.js (no jQuery or Bootstrap)

ZOOM.JS Repo status Nov 2020: Maintained, but bug fixes only. No new features currently, please. There may eventually be a new major version with new

Nishanth Shanmugham 1.3k Jan 3, 2023
A variety of jQuery plugin patterns for jump starting your plugin development

jQuery Plugin Patterns So, you've tried out jQuery Boilerplate or written a few of your own plugins before. They work to a degree and are readable, bu

jQuery Boilerplate 1.6k Dec 31, 2022
This is a simple Image popup Jquery plugin. With a very simple configuration, you can show a popup on your webpage. By the way, this plugin works after page load.

Jquery-SingleImagePopup This is a simple Image popup Jquery plugin. With a very simple configuration, you can show a popup on your webpage. By the way

Rajan Karmaker 1 Aug 22, 2022
POC implementation of liveblocks.io obsidian plugin

Obsidian Liveblocks by shabegom A POC implementation of liveblocks.io inside an obsidian plugin. Install Create an account at https://liveblocks.io Gr

Sam 9 Oct 7, 2022