简体   繁体   中英

Click Functionality doesn't work properly in mobile devices

We are facing an issue in our shopify website in mobile devices. On clicking a category, it opens and child menu items dropped down. But it doesn't get closed on clicking back. Only it gets closed, when we click on another category menu.

Could anyone help here. Thanks in advance.

Its better to show code you are trying.

Main problem is OnClick Event does not register on mobile devices that is because you don't click on anything you generally tap on menu. So it will be better if you add mobile event along with it. like you can use touchstart event as give in code below

$(document).ready(function() { 
    $('ul li').on('click touchstart', function() {

    // Show Menu Item

    });
});

Another Alternative Option

you can also detect touch devices and manipulate things -

$(document).ready(function() {      
    /* Detect Mobile Device As Below */
    if(is_touch_device()) {  
        // Code Here to handle for Mobile
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM