Home Forums WoodMart support forum Tap Anywhere on Mobile Menu Item for Dropdown

Tap Anywhere on Mobile Menu Item for Dropdown

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #357718

    jg
    Participant

    Hi there,

    I have clients complaining that the mobile menu is not intuitive to use because you need to tap the arrow to open the dropdown, and if you tap the menu item itself, nothing happens.

    I found this code on other topics and it worked for those customers, but it doesn’t seem to work for me:

    jQuery(‘.mobile-nav’).on(‘click’, ‘.site-mobile-menu > li.menu-item-has-children > a’, function(e){
    e.preventDefault();
    jQuery(this).parent().find(‘.icon-sub-menu’).click();
    });

    I’ve tried it both on document ready and in the global custom JS fields with no luck. I’ve included access to my staging area so you can have a look.

    Thanks!

    #357754

    Artem Temos
    Keymaster

    Hello,

    Try to replace the code with the following

    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();
    });

    Kind Regards

    #357762

    jg
    Participant

    Wonderful, that works wonders!

    One issue though, if the dropdown menu item has another dropdown submenu within it, when you open the first layer by tapping the text, all other layers open by default and it is confusing. If you click the arrow instead of the text, submenus are shown, but closed as they should be.

    Is there some piece of the code you shared that can be changed to stop the submenus from opening by default?

    Thanks again!

    #357824

    Artem Temos
    Keymaster

    Try to replace the code with this one

    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();
    });
    #357993

    jg
    Participant

    Thanks very much!

    #358080

    jg
    Participant

    Sorry to bug you again, but I just realized that the latest code you shared works perfectly for top layer submenus, but when trying to open the second layer submenu, you have to click the arrow again.

    Any suggestions to edit that code snippet?

    Thanks

    #358113

    Artem Temos
    Keymaster

    Here is the right code for all levels

    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();
    });
    #422163

    jg
    Participant

    Hi, this code no longer works.

    Can you please provide an updated script for this function?

    Thanks

    #422429

    Artem Temos
    Keymaster

    Hi,

    Could you please send us a link to your website where we can see this issue? Make sure that the code is currently added to your website.

    Kind Regards

    #422640

    jg
    Participant

    The code is currently implemented on document ready in custom JS panel of theme . Check private area for site details.

    #422709

    Artem Temos
    Keymaster

    Hello,

    As we can see, the code is working correctly on your website at the moment https://gyazo.com/b1841457b3698dbda55e15f7b057a785

    Kind Regards

Tagged: 

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