Making mobile menu submenu's open / expanded by default

is there a way to make the mobile menu submenu open by default when the mobile menu is triggered? by default, when you open the mobile menu, the submenus are collapsed:

i’d like it to appear open/expanded:

i see another user wanted to do this, but the js provided was a couple of years ago and doesn’t appear to work any longer:

site: https://tinyurl.com/ybzv2dcs

thanks

Hi there,

Thanks for writing in! To achieve this, try adding the following code in the Theme Options > JS:

jQuery(document).ready(function($){
	$('.x-btn-navbar').on('touchend click', function(e) {
		$('.x-sub-toggle').click();
	});
});

Don’t forget to clear your browser’s cache after adding the code. I inspected your site and I see is an error due to an invalid code in your Theme Options > JS: section, please find and remove the following code, otherwise the above code won’t work:

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-677157-12"></script>

Please note that you don’t need to include the <script></script> tags as they are already included.

Let us know how this goes!

Thanks, this seemed to work. Also, thank you for the heads up on the tags. I think removing them also solved another issue I was experiencing. You guys should put a note in the JS section as it’s the most logical place to copy/paste an Analytics code :slight_smile: (tried your Analytics extension but it looks like it’s currently experiencing issues - I also like to keep my plugin number to a minimum).

Hi again,

Glad it worked. We’ve already added a note in Global JS section not to include the script tags (see screenshot)

You can see this note when thee is no code inside.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.