Why isn't my mobile menu opening?

Topic summary

A user is experiencing an issue where their mobile hamburger menu fails to open when clicked. The menu doesn’t display on mobile devices despite attempts to fix it.

Proposed Solution:

  • The problem likely stems from the defer attribute on the jQuery script tag in theme.liquid
  • The defer property causes jQuery to load after the HTML document, but header.js and other scripts require jQuery to be available immediately
  • This creates a dependency conflict where scripts needing jQuery fail because it hasn’t loaded yet

Recommended Fix:
Remove the defer attribute from the jQuery script tag so it loads synchronously before dependent scripts execute.

Current Status:
The original poster reports being unable to locate the specific code mentioned in their theme.liquid file, suggesting the issue remains unresolved and may require further troubleshooting or clarification on file structure.

Summarized with AI on November 21. AI used: claude-sonnet-4-5-20250929.

Hi @All Hope you are doing great. I am having an issue with my mobile menu that it’s not opening and I have tried to fix via different methods but still same issue. While click on hamburger on mobile it doesn’t show menu. Please check below are the link to site

Link: https://www.getswitchbands.com/?_ab=0&_fd=0&_sc=1

Thanks

Your problem is (most probably) here – in your theme.liquid the code should look similar to this:

  
 
{{ 'header.js' | asset_url | script_tag }}

You’re using defer property on script tag for jquery which means – “load this script later, when document is loaded”. Browser will run this script only after your HTML is loaded.

However, your ‘header.js’ does not have this property and is loaded immediately when browser reads this line. The code in this files needs jQuery, but it’s not yet loaded (because of defer) and it fails.

There are other scripts on your page which need jQuery, and they fail too.

Try replacing the code above with this:

 
{{ 'header.js' | asset_url | script_tag }}

Hi, I didn’t find any code like this in theme.liquid