MobileMenu is a tiny very customizable jquery plugin for turn any block or menu to look-alike on-canvas menus with submenus.
As demo you can check menu of this site on 619 or lower screen size. Or click link below for more detailed demo
Open MenuYou can download it from here.
Or from project github page https://github.com/sargismarkosyan/MobileMenu
MobileMenu have some options:
menu: false
menu block, it can be used if you want attach block to an existing menu objectmenuOpenIcon: false
menu opener element html codemenuOpenObject: false
element witch mast be clicked for menu opening, if this parameter is set no need for menuOpenIconbody: ''
menu inner html, by default it will get content of selector elementonInit: false
callback after menu is initializedonOpen: false
callback after menu openingonClose: false
callback after menu closingonUlInit: false
plugin recursively check each ul inside block and do some modifications for it, you can add callback for do some changestheme: 'mobilemenu-theme'
this class will be attached in menu block and by default menuOpenIcon itemHere is an example
var menu = $('.menu').mobilemenu({
menuOpenIcon: '<span class="mobilemenu--open-icon">Click to open menu</span>',
body: '<p>some body</p>',
onInit: function(menu, options){
console.log(menu);
console.log(options);
},
onOpen: function(menu, options){
console.log(menu);
console.log(options);
},
onClose: function(menu, options){
console.log(menu);
console.log(options);
},
onUlInit: function(ul, index, menu, options){
console.log(ul);
console.log(index);
console.log(menu);
console.log(options);
}
});
menu.openMenu();
MobileMenu return object with functions:
menu
this is menu objectmenuInner
menu inside content objectopenMenu
opening menucloseMenu
closing menuupdateMenu
this will update ul elements, its needs to be called after menuInner modifications