tb-megamenu how to click to open/close sub menu in mobile We are attempting to get submenus to only appear when the user "taps" the menu option on a mobile browser. This functionality works good on hover but some mobile devices don't work with hovering. We need the ability to click submenu titles in order to drop them down and then click them again to collapse them.
Then look far, the best I found in my case has been the following:

I have overridden the method (js) of tb MegaMenu and done through the function drupal


I created a copy of tb-megaMenu-frontend.js file and called tbmega-custom.js and saved in the js folder of my theme.
What added to the system through the function drupal js_alter.
In my theme in the file called template.php 

function mytheme_js_alter (&amp;$javascript){
    $javascript[drupal_get_path('module', 'tb_megamenu') . '/js/tb-megamenu-frontend.js']['data'] = path_to_theme() . '/js/tbmega-custom.js';
}

I have adjusted the code to my needs. Just change the behavior of tbMegaMenuAction:

 Drupal.behaviors.tbMegaMenuAction = {
    attach: function (context) {
        $('.tb-megamenu-button', context).once('menuIstance', function () {
        var This = this;
        $(This).click(function () {
            if (parseInt($(this).parent().children('.nav-collapse').height())) {
                $(this).parent().children('.nav-collapse').css({height: 0, overflow: 'hidden'});
                Drupal.TBMegaMenu.displayedMenuMobile = false;
            }
            else {
                $(this).parent().children('.nav-collapse').css({height: 'auto', overflow: 'visible'});
                Drupal.TBMegaMenu.displayedMenuMobile = true;
            }
        });
    });

    //Comment this for mobile click
    //var isTouch = 'ontouchstart' in window &amp;&amp; !(/hp-tablet/gi).test(navigator.appVersion);
    //if (isTouch) {


        $(document).ready(function ($) {
            var mm_duration = 0;
            $('.tb-megamenu').each(function () {
                if ($(this).data('duration')) {
                    mm_duration = $(this).data('duration');
                }
            });
            var mm_timeout = mm_duration ? 100 + mm_duration : 500;



            $('.nav &gt; li, li.mega').click(function (event) {
                event.preventDefault();

                var $this = $(this);

                if ($this.hasClass('mega') &amp;&amp; !$this.hasClass('clicado')) {

                    $('.nav &gt; li, li.mega').each(function () {
                        $(this).removeClass('clicado open');
                    });


                    $this.addClass('clicado');
                    $this.addClass('animating');
                    clearTimeout($this.data('animatingTimeout'));
                    $this.data('animatingTimeout', setTimeout(function() {
                        $this.removeClass('animating')
                    }, mm_timeout));
                    clearTimeout($this.data('hoverTimeout'));
                    $this.data('hoverTimeout', setTimeout(function() {
                        $this.addClass('open')
                    }, 100));



                } else {

                    if($this.hasClass('mega') &amp;&amp; $this.hasClass('clicado')) {

                        $this.removeClass('clicado');
                        $this.addClass('animating');
                        clearTimeout($this.data('animatingTimeout'));
                        $this.data('animatingTimeout', setTimeout(function() {
                            $this.removeClass('animating')
                        }, mm_timeout));
                        clearTimeout($this.data('hoverTimeout'));
                        $this.data('hoverTimeout', setTimeout(function() {
                            $this.removeClass('open')
                        }, 100));
                    }

                }

            });
        });

    //}

    $(window).resize(function () {
        var windowWidth = window.innerWidth ? window.innerWidth : $(window).width();
        if (windowWidth != Drupal.TBMegaMenu.oldWindowWidth) {
            Drupal.TBMegaMenu.oldWindowWidth = windowWidth;
            Drupal.TBMegaMenu.menuResponsive();
        }
    });
  }
 }