Mobile Menu Child Items - Forum | JoomShaper
Solved SP Page Builder

Mobile Menu Child Items

Asked by Michael Koerner 3 years ago Last activity 3 years ago

hello:

how can i make it to where when you click on the parent item in mobile menu, it collapses the children automatically. Then, if you want to click the parent one, clicking it second time takes you to that parent page?

Thanks!

Accepted answer

Marked as the solution
Ofi Khan Staff

Hello Michael Koerner

Please use this JavaScript to Template Options -> Custom Code -> Custom JavaScript

jQuery(function($) {
    $(document).on("click", ".menu-deeper", function(event) {
        if (event.target.classList.contains('menu-toggler')) return;
        if (event.target.children.length) {
            event.preventDefault();
            event.stopPropagation();
            $(this)
                .toggleClass("menu-parent-open")
                .find(">.menu-child")
                .slideToggle(400);
        }
    });
});

This will allow the parent menu items to open child items while being clicked on titles. The rest customization is on your hand. Sorry, we do not provide customization support.

Best regards

2 more replies

Michael Koerner Asked this

Hey there Ofi:

Thank you so much for that. It worked perfectly!

Take care,

Ofi Khan Staff

You are welcome 😊

I have a humble request. It would be very kind of you if you can manage some moment to give us feedback on 

  1. Joomla Extension Directory
  2. TrustPilot

This will inspire us to improve.

Log in to reply.