0

My Mobile Menu Not show any sub menu.

menu.phtml

<?php $menuData = Mage::helper('custommenu')->getMenuData(); extract($menuData); ?>
<div class="nav-container">
    <div id="custommenu-loading" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
        <div class="menu">
            <div class="parentMenu menu0">
                <a href="javascript:;">
                    <span><?php echo $this->__('Loading...'); ?></span>
                </a>
            </div>
        </div>
        <div class="clearBoth"></div>
    </div>
    <div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>" style="display:none;">
        <div class="menu">
            <div class="parentMenu menu0">
                <a href="javascript:;">
                    <span><?php echo $this->__('Loading...'); ?></span>
                </a>
            </div>
        </div>
        <div class="clearBoth"></div>
    </div>
    <div id="custommenu-mobile" class="<?php echo $_rtl ? ' rtl' : ''; ?>" style="display:none;">
        <div id="menu-button" onclick="MenuButtonToggle()" style="display:none !important;">
            <a href="javascript:void(0);">
                <span><?php echo $this->__('Menu'); ?></span>
            </a>
        </div>
        <div id="menu-content" style="display:block !important;">
            <div id="menu-mobile-loading" class="menu-mobile level0">
                <div class="parentMenu">
                    <a href="javascript:;">
                        <span><?php echo $this->__('Loading...'); ?></span>
                    </a>
                </div>
            </div>
            <div class="clearBoth"></div>
        </div>
    </div>
</div>
<script type="text/javascript">
//<![CDATA[
var CUSTOMMENU_POPUP_WIDTH = <?php echo $_popupWidth; ?>;
var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo $_popupTopOffset; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo $_popupDelayBeforeDisplaying; ?>;
var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo $_popupDelayBeforeHiding; ?>;
var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
var CustommenuTimerShow = {};
var CustommenuTimerHide = {};
var ActiveMenu = null;
var MobileMenuEnabled = <?php echo $_mobileMenuEnabled; ?>;
var MenuAjaxUrl = '<?php echo $_menuAjaxUrl; ?>';
var MoblieMenuAjaxUrl = '<?php echo $_moblieMenuAjaxUrl; ?>';
var PopupMenuContent = '';
var MobileMenuContent = '';
CustomMenuMobileToggle();
Event.observe(window, 'resize', function() {
    CustomMenuMobileToggle();
});
//]]>
</script>

.js

/* Mobile */
function MenuButtonToggle()
{
    $('menu-content').toggle();
}

function GetMobileSubMenuLevel(id)
{
    var rel = $(id).readAttribute('rel');
    return parseInt(rel.replace('level', ''));
}

function SubMenuToggle(obj, activeMenuId, activeSubMenuId)
{
    var currLevel = GetMobileSubMenuLevel(activeSubMenuId);
    // --- hide submenus ---
    $$('.wp-custom-menu-submenu').each(function(item) {
        if (item.id == activeSubMenuId) return;
        var xLevel = GetMobileSubMenuLevel(item.id);
        if (xLevel >= currLevel) {
            $(item).hide();
        }
    });
    // --- reset button state ---
    $('custommenu-mobile').select('span.button').each(function(xItem) {
        var subMenuId = $(xItem).readAttribute('rel');
        if (!$(subMenuId).visible()) {
            $(xItem).removeClassName('open');
        }
    });
    // ---
    if ($(activeSubMenuId).getStyle('display') == 'none') {
        $(activeSubMenuId).show();
        $(obj).addClassName('open');
    } else {
        $(activeSubMenuId).hide();
        $(obj).removeClassName('open');
    }
}

function ResetMobileMenuState()
{
    $('menu-content').hide();
    $$('.wp-custom-menu-submenu').each(function(item) {
        $(item).hide();
    });
    $('custommenu-mobile').select('span.button').each(function(item) {
        $(item).removeClassName('open');
    });
}

function CustomMenuMobileToggle()
{
    var w = window,
        d = document,
        e = d.documentElement,
        g = d.getElementsByTagName('body')[0],
        x = w.innerWidth || e.clientWidth || g.clientWidth,
        y = w.innerHeight|| e.clientHeight|| g.clientHeight;

    if ((x < 800 && IsMobile.any()) && MobileMenuEnabled) {
        InitMobileMenuContent();
        $('custommenu').hide();
        $('custommenu-mobile').show();
        // --- ajax load ---
        if (MoblieMenuAjaxUrl) {
            new Ajax.Request(
                MoblieMenuAjaxUrl, {
                    asynchronous: true,
                    method: 'post',
                    onSuccess: function(transport) {
                        if (transport && transport.responseText) {
                            try {
                                response = eval('(' + transport.responseText + ')');
                            } catch (e) {
                                response = {};
                            }
                        }
                        MobileMenuContent = response;
                        MobileMenuLoaded = false;
                        InitMobileMenuContent();
                    }
                }
            );
            MoblieMenuAjaxUrl = null;
        }
    } else {
        $('custommenu-mobile').hide();
        ResetMobileMenuState();
        $('custommenu').show();
        // --- ajax load ---
        if (MenuAjaxUrl) {
            new Ajax.Request(
                MenuAjaxUrl, {
                    asynchronous: true,
                    method: 'post',
                    onSuccess: function(transport) {
                        if (transport && transport.responseText) {
                            try {
                                response = eval('(' + transport.responseText + ')');
                            } catch (e) {
                                response = {};
                            }
                        }
                        if ($('custommenu')) $('custommenu').update(response.topMenu);
                        PopupMenuContent = response.popupMenu;
                    }
                }
            );
            MenuAjaxUrl = null;
        }
    }

    if ($('custommenu-loading')) $('custommenu-loading').remove();
}

What is the problem here?

  • live link of this ?? – Qaisar Satti Mar 3 '16 at 12:49
  • which device this creating the problem? – Qaisar Satti Mar 3 '16 at 12:53
  • All Mobile Device i check Chrome also same problem – Magento 2 Mar 3 '16 at 12:56
  • Firefox have not problem i checked it.. – Qaisar Satti Mar 3 '16 at 13:03
  • yes but Mobile and chrome have problem – Magento 2 Mar 3 '16 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.