Solved

Mobile Version Of The Drop Down Menu Doesn't Work Correctly

ipekum
New Member
12 0 0
2 0 0

Hello,

My dropdown menu doesn't work correctly on mobile, it's supposed to expand and show the sub categories but instead it redirects to the main collection.

 <i class="fa fa-bars dropdown-toggle icon"></i> is there on the header.liquid but somehow it doesn't work. 

I can also add my mainmenu-mobile.liquid if needed  (Not sure if it's the source of the problem)

Would be great if you could help

Thanks in advance 🙂

Ipek

 

 

Accepted Solutions (2)
diego_ezfy
Shopify Partner
2958 568 890

This is an accepted solution.

There is a typo in my code, sorry, please replace all code with this:


<script>
function mobileFix(){

    var a = document.querySelectorAll(`.has-child .site-nav-link`);

    if (!a){
        return;
    }
    for (var each of a){
    each.addEventListener('click',function(el){
    el.preventDefault();
    el.target.classList.toggle('show--dropdown');
    });
    }
}

mobileFix();
</script>

<style>
@media (max-width:767px){
    .header .nou_megamenu{
    width: 100% !important; 
}
.show--dropdown + .sub-menu-dropdown{
    display: block !important;
}
}
</style>
◦ Follow my blog & youtube for coding tutorials.
◦ Replace apps with copy/paste code snippets and save money.

View solution in original post

diego_ezfy
Shopify Partner
2958 568 890

This is an accepted solution.

@ipekum 

It would require a more complex custom code, if it's of your interest I'm available for hire and would be happy to help. 

Kindly click on "accept as solution" and "like" to help other people in the community with similar issues,


Kind regards,
Diego

◦ Follow my blog & youtube for coding tutorials.
◦ Replace apps with copy/paste code snippets and save money.

View solution in original post

Replies 17 (17)