SubMenu Not Appear In Mobile View - Question | JoomShaper
🎃 Halloween Sale is Live! Get 35% OFF on all plans. Sale ends soon! Get Offer

SubMenu Not Appear In Mobile View

M

MCPO-UMP

Template 8 months ago

Hi, submenu not appear in mobile view. After update to Joomla4.

PHP Version 7.4.33 Joomla 4.4.10

https://prnt.sc/iPJfjoAhQvS5

0
5 Answers
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 7 months ago #186165

I add this js and css in your custom code section, Follow this guide to add custom code: https://www.joomshaper.com/documentation/helix-framework/custom-code-css-js-meta

document.addEventListener("DOMContentLoaded", function () {
  document.querySelectorAll(".menu-parent").forEach(function (parent) {
    // Create a span element for the toggle
    let toggle = document.createElement("span");
    toggle.classList.add("submenu-toggle");
    toggle.textContent = "+"; // Default to collapsed

    // Insert toggle icon inside the menu parent
    parent.querySelector("a").after(toggle);

    // Toggle submenu on click
    toggle.addEventListener("click", function () {
      let submenu = parent.querySelector(".menu-child");
      if (submenu) {
        submenu.style.display = submenu.style.display === "block" ? "none" : "block";
        toggle.textContent = submenu.style.display === "block" ? "−" : "+";
      }
    });
  });
});

anfd this css:

.menu-parent {
  position: relative;
}

.submenu-toggle {
  position: absolute !important;
  right: 10px;
  cursor: pointer;
  font-size: 18px !important;
  font-weight: bold;
    z-index: 12;
}

.menu-child {
  display: none; /* Initially hidden */
}

.menu-child.show {
  display: block;
}

.offcanvas-menu .offcanvas-inner .sp-module ul>li a, .offcanvas-menu .offcanvas-inner .sp-module ul>li span {
    display: flex;
    font-size: 1rem;
    padding: 0.125rem 0;
    position: unset;
}
.offcanvas-menu .offcanvas-inner .sp-module ul>li {
    overflow: unset !important;
}
0
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 7 months ago #186158

Hello,

Thanks for reaching out to us. I apologize for the inconvenience. I have resolved your issue.

Please check and let me know if everything is working fine.

Thanks,

0
M
MCPO-UMP
Accepted Answer
7 months ago #186162

Thank you for your prompt assistance. Could you share the solution to this issue? There are still nearly 40 websites that need fixing, so I would like to correct them myself.

0
M
MCPO-UMP
Accepted Answer
7 months ago #186616

I can put css in physical file custom.css, how about js.. and where the location to put in.

0
Ziaul Kabir
Ziaul Kabir
Accepted Answer
Support Agent 7 months ago #186640
0