Social Now (MyThemeShop)
Fix Mobile Menu
If you have Max Mega Menu enabled for the mobile location, you’ll find clicking on parent item links prematurely closes the mobile slideout panel. To fix this, add the following to your child themes functions.php file:
1 2 3 4 5 6 7 8 9 |
/** Add 'toggle-caret' class to all menu item links to prevent the theme from closing the mobile menu whenever a link is clicked **/ function megamenu_prevent_premature_mobile_menu_close( $atts, $item, $args ) { if ( $args->theme_location == 'mobile' ) { $atts['class'] = $atts['class'] . " toggle-caret"; } return $atts; } add_filter( 'megamenu_nav_menu_link_attributes', 'megamenu_prevent_premature_mobile_menu_close', 10, 3 ); |
Next install the TC Custom JavaScript plugin and add the following to Appearance > Custom JavaScript:
1 2 3 4 5 6 7 8 9 |
jQuery(document).ready(function( $ ) { jQuery(".toggle-mobile-menu").on("click", function() { setTimeout(function(){ /** Reinitialise Max Mega Menu to fix click events **/ jQuery('#mega-menu-mobile span.mega-indicator').removeAttr('data-has-click-event'); jQuery('#mega-menu-mobile').unbind().removeData().maxmegamenu(); }, 250); }); }); |