var $offCanvasNav = $('.offcanvas-navigation'),
$offCanvasNavSubMenu = $offCanvasNav.find('.sub-menu', '.mega');
/ * ADICIONAR BOTAO DE ALTERNANCIA (submenu) * /
$offCanvasNavSubMenu.parent().prepend('<span class="menu-expand"><i></i></span>');
/*Categoria Sub Menu Toggle*/
$offCanvasNav.on('click', 'li a, li .menu-expand', function(e) {
var $this = $(this);
if ( $this.parent().attr('class').match(/\b(menu-item-has-children|has-children|has-sub-menu)\b/) || ($this.attr('href') === '#' || $this.hasClass('menu-expand')) ) {
e.preventDefault();
if ($this.siblings('ul:visible').length){
$this.parent('li').removeClass('active').children('ul').slideUp().siblings('a').find('.menu-expand i').removeClass('zmdi-chevron-up').addClass('fa fa angle-down');
$this.parent('li').siblings('li').removeClass('active').find('ul:visible').slideUp().siblings('a').find('.menu-expand i').removeClass('fa fa angle-up').addClass('fa fa angle-down');
} else {
$this.parent('li').addClass('active').children('ul').slideDown().siblings('a').find('.menu-expand i').removeClass('zmdi-chevron-down').addClass('zmdi-chevron-up');
$this.parent('li').siblings('li').removeClass('active').find('ul:visible').slideUp().siblings('a').find('.menu-expand i').removeClass('fa fa angle-up').addClass('fa fa angle-down');
}
}
});
Este codigo coloca uma class de menu-expand com icones a a a classe (sub-menu) queria fazer o mesmo com a classe (mega)
===================UB-MENU===================
<li class="menu-item-has-children">
<span class="menu-expand"><i></i></span> ----------------------class menu-expand adicioando com o codigo javascript acima
<a href="index.html">Home</a>
<ul class="sub-menu">
<li><a href="index.html">Home One</a></li>
</ul>
</li>
===================MEGA======================
<li class="menu-item-has-children">
----------------------queria adicoanr aqui tambem a class menu-expand
<a href="index.html">Home</a>
<ul class="mega">
<li><a href="index.html">shop</a></li>
</ul>
</li>