JRoy
11/6/2019 - 1:54 PM

mmenu ungroup

$(document).ready(function() {
        // Move Main List Items Into parent Container - Ungroup Main List Items
        jQuery('.menu-toggle').click(function(){
            jQuery('#mmenu').find('li.ungroup').each(function(){
                var mainListDummyParent = jQuery(this);
                var finalParentContainer = jQuery(this).parent();
                var childListContainerSelector = jQuery(this).find('.mm-btn_next').attr('href');
                var childListContainer = jQuery('.mm-panels').find(childListContainerSelector);
                childListContainer.find('ul').each(function(){
                    var fullList = jQuery(this).html();
                    finalParentContainer.append(fullList);
                });
                mainListDummyParent.remove();
            });
        });
    });