Mobile: submenus are opening by default in Upfront

The submenus in the mobile menu are opening by default in Upfront, I tried this fix, butc licking on items and getting drop downs to re-appear is hit and miss.

https://premium.wpmudev.org/forums/topic/mobile-menu-is-breaking-for-submenu#post-1285561

  • James Morris
    • WordPress Enthusiast

    Hello Lee,

    I hope you are well today. I'll be following up with your chat.

    The jQuery you're going to need in this situation is as follows:

    jQuery(document).ready( function($) {
        $(".sub-menu").hide();
        $("li.menu-item-has-children").click(function (e) {
            e.stopPropagation();
            $(this).children('ul').toggle();
        });
     });

    However, there's some minor changes you'll need to make for this to work cleanly...

    Your Local Attractions link is setup ideally for the above jQuery in that the parent menu element does not actually have an active link. It's an empty anchor tag that just makes the text clickable.

    However, your About Us and Rooms links have active URLs in the anchor tag. This causes the link to activate on click thus redirecting the page as the submenu is displayed. It would be better to mimic the setup of your Local Attractions link on the About Us and Rooms parent menu links so that this does not happen. If needed, you could move the desired target page as a submenu link.

    I hope this clarifies a bit. Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.