1

The Magento 2 mobile menu is already fully expanded by default revealing all categories and subcategories which is a huge problem if you have a very deep menu structure. I have been able to make it collapsed by default by changing "expanded" to "false" in the topmenu.html file.

{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}

Now my issue is that once you click on a 2nd level item to "expand" or reveal the 3rd level menu items, it instantly redirects you to the 2nd level category. Is there a way to remove the redirect function when clicking on the 2nd level menu items so that you can continue to drill down into the menu structure without being redirected?

Can someone please help me.

Thanks in advance!

1 Answer 1

0

Find the below code snippet in lib/web/mage/menu.js, that is where the redirect happens in mobile view. You could custom the check condition logic to determine if it should redirect or not.


if (!target.hasClass('level-top') || !target.has('.ui-menu').length) {
    window.location.href = target.find('> a').attr('href');
}
1

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.