• Resolved Antonio Augusto

    (@antonio24073)


    Hi,

    1 – Please put an option to disable and remove the mobile version code if not needed. I solved this temporarily with “Menu themes > Mobile Menu > Responsive Breakpoint > 1px”.

    2 – Please include this jquery:

    jQuery('body').on('touchstart touchend', function(e) {
            if(jQuery('.mega-toggle-on').length !== 0){
                jQuery('.mega-toggle-on').removeClass("mega-toggle-on");
            }
     });

    Solves: the problem: When in mobile with touch mode (desktop menu version in mobile with the low responsive breakpoint), the submenu was not closing, if you click in another element in the page, it keeps opened.

    Notify me here please if you liked this. And notify me if you update.

    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Antonio Augusto

    (@antonio24073)

    If somebody likes here’s the complete code for the functions.php:

    
    function ow_max_mega_menu_scripts()
    {
        if (!is_admin()) {
            $js = <<<EOD
                jQuery('body').on('touchstart touchend', function(e) {
                    if(jQuery('.mega-toggle-on').length !== 0){
                        jQuery('.mega-toggle-on').removeClass("mega-toggle-on");
                    }
                });
                EOD;
            wp_register_script('ow-infinite-scroll-autostart-footer', '', array("jquery"), '', true);
            wp_enqueue_script('ow-infinite-scroll-autostart-footer');
            wp_add_inline_script('ow-infinite-scroll-autostart-footer', $js, 'after');
        }
    }

    Thread Starter Antonio Augusto

    (@antonio24073)

    A small fix:

    
                jQuery('body').on('touchstart touchend', function(e) {
                    if(jQuery('.mega-toggle-on').length !== 0 && !jQuery('.mega-toggle-on').has(e.target).length){
                        jQuery('.mega-toggle-on').removeClass("mega-toggle-on");
                    }
                });
    Plugin Author megamenu

    (@megamenu)

    Hi Antonio,

    Thanks for this. Does it help if (without your code), you change line 2.3.2 of maxmegamenu.js to include ‘touchstart’?

    Regards,
    Tom

    Plugin Author megamenu

    (@megamenu)

    Hi Antonio,

    I’ve tested (with no code changes) on mobile and I’m not seeing the same behaviour here (i.e. it works as expected):

    If you’d like me to take another look, please first try narrowing the issue down by testing with all plugins disabled and using a default theme.

    Regards,
    Tom

    Thread Starter Antonio Augusto

    (@antonio24073)

    I changed only the below:

    https://app.screencast.com/8NBeU3nJHADDf

    Please, how you do the embed of video?

    Plugin Author megamenu

    (@megamenu)

    Hi Antonio,

    Thanks. I see you must have some custom CSS or JS that scrolls the top menu items and that might have something to do with it. Something is possibly also fixing the position of the sub menus.

    In my testing with a standard installation I do not see the same thing (see my video), please try testing with no additional custom code. You can also try testing on megamenu.com.

    Regards,
    Tom

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Touch not closing and option to disable and remove code for mobile’ is closed to new replies.