Black Friday 2026 50% off every plan Our biggest deal of the year on #1 Joomla products.
Ends in 13d 04h 33m 32s
Claim 50% off
Solved Templates

Off-canvas menu in Wayne Corp template

Asked by sandymikami 2 years ago Last activity 2 years ago

Hi Joomshaper

With the off-canvas menu in the Wayne Corp template, I need to be able to click on top level menu items (URL #) and have the sub menu items open up. At the moment, the sub menu items only open up if you click directly on the left hand side arrow. It's too easy for people to click on just the menu item and think it's not working. What code do I need so that both the arrow and the menu item will open the sub menu when clicked?

Thanks

Accepted answer

Marked as the solution
Ofi Khan Staff

Hello sandymikami

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

Best regards

sandymikami Asked this

Perfect, thanks!

Ofi Khan Staff

You are welcome 😊

There is an update. Please use this JavaScript

$(document).on("click", ".menu-deeper", function(event) {
    if (event.target.classList.contains('menu-toggler')) return;
    const linkElement = $(this).find("a")[0];
    if (linkElement && linkElement.getAttribute("href") === "#") {
        event.preventDefault();
    }
    if (event.target.children.length) {
        event.stopPropagation();
        $(this)
            .toggleClass("menu-parent-open")
            .find(">.menu-child")
            .slideToggle(400);
    }
});
Log in to reply.