Home Forums WoodMart support forum Adjusting Mobile Menu Behavior for Parent Categories

Adjusting Mobile Menu Behavior for Parent Categories

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #631072

    lost.hinata
    Participant

    Hello,

    On the mobile version of my site, the menu currently displays categories, and when clicking on the arrow, the categories expand to show subcategories or sub-subcategories. This behavior works perfectly for me.

    However, the parent categories at the first level are also clickable, and I would like to disable this behavior. Instead, I want clicking on the parent category name to perform the same action as the arrow, expanding the menu to show subcategories.

    How can I achieve this?

    Thank you.

    #631358

    Hung Pham
    Participant

    Hi lost.hinata,

    Thanks for reaching to us and appreciate your patience.

    Navigate to Theme Settings > Custom JS > Add the following code.

    jQuery('.mobile-nav').on('click', '.wd-nav-mobile > li.menu-item-has-children > a', function(e){
       e.preventDefault();
       jQuery(this).parent().find('.wd-nav-opener').click();
    });

    Regards,

    #632873

    lost.hinata
    Participant

    Thanks alot, its perfect 🙂
    J’ai ajouté des un autre niveau de menu, pouvouvz me fornur un nouveau js à jour ?
    Merci

    exemple :

    MOBILIER
    -BANCS
    — bancs en bois
    — bancs en fer
    ….

    #632874

    lost.hinata
    Participant

    Update :

    Sometimes I will add a subcategory under a parent category.
    Could you please let me know how to update your JavaScript code so that these menus behave the same as the rest now?

    Thank you!

    #632968

    Serg Sokhatskyi
    Keymaster
    Xtemos team

    Hi,

    Apologies for the misunderstanding. To resolve your issue, you need to remove the custom code we provided in the previous response: https://xtemos.com/forums/topic/adjusting-mobile-menu-behavior-for-parent-categories/#post-631358. After that, go to the mobile menu header element settings and select Submenu opening action → Label and arrow like it shown on screenshot: https://monosnap.com/file/oaXL5ylkCPZo2qmxGLUa77QvWp3H9Y.

    Kind Regards

Viewing 5 posts - 1 through 5 (of 5 total)