Re: Hamburger Menu on mobile isn't working

Solved

Hamburger Menu on mobile isn't working

ellzmai45
Tourist
3 0 1

Since updating to the latest DAWN template hamburger menu does not open on mobile!

have been through previous threads with this issue amending the code and nothing has worked

can anyone help?

www.lunacrest.co.uk

Accepted Solution (1)

tim
Shopify Partner
3911 395 1440

This is an accepted solution.

Nope, it's not a CSS issue.

You have a broken HTML structure.

Menu does not work because your <html> element does not have "js" class, but has "no-js" instead and this happens because your SEO App code is added improperly. See how there are 2 <html> opening tags -- this is not allowed.

Browser will try to fix the problem and simply ignore the second one -- this is how you'll end up with <html class="no-js" ... > which prevents your menu from working properly (probably other areas are affected as well).

Note that Shopify has removed handling of "no-js" in recent versions of Dawn, it must be "js":

https://github.com/Shopify/dawn/pull/3245 :

 

Click to expand...

Why no <noscript>?
Javascript is an integral part of the modern web. Without JS, new Shopify theme features like Combined Listings simply will not work well because they require the use of the section API to progressively load content. Additionally, Checkout Extensibility (Shopify's upgraded checkout) requires JS. There is no value in the theme letting a no-JS user add items to cart if they aren't able to checkout, it would be better to fail fast.

 

Screenshot 2024-06-20 at 2.26.54 PM.png

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com

View solution in original post

Replies 12 (12)

Made4uo-Ribe
Shopify Partner
9687 2303 2877

Hi @ellzmai45 

Check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes"

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "theme. Liquid" file. Find the </body> tag and paste the code below before the tag. 

 

<style>
header-drawer .menu-drawer {
    transform: unset;
    visibility: visible;
}
</style>

 

And Save. 

result:

Made4uoRibe_0-1718829985859.png

 

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
Create custom Shopify pages effortlessly with PageFly's drag-and-drop ⚙️.
ellzmai45
Tourist
3 0 1

TEST.jpg

 

This didn't work unfortunately, does this look correct?

Made4uo-Ribe
Shopify Partner
9687 2303 2877

Yes, can you try to add on the custom.css on your theme editor. 

Click the header 

Made4uoRibe_0-1718832085391.png

On the right side there will be new tab. 

Find this one. 

Made4uoRibe_1-1718832117596.png

And paste the code below. 

.menu-drawer {
    transform: unset;
    visibility: visible;
}

And Save.

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
Create custom Shopify pages effortlessly with PageFly's drag-and-drop ⚙️.

tim
Shopify Partner
3911 395 1440

This is an accepted solution.

Nope, it's not a CSS issue.

You have a broken HTML structure.

Menu does not work because your <html> element does not have "js" class, but has "no-js" instead and this happens because your SEO App code is added improperly. See how there are 2 <html> opening tags -- this is not allowed.

Browser will try to fix the problem and simply ignore the second one -- this is how you'll end up with <html class="no-js" ... > which prevents your menu from working properly (probably other areas are affected as well).

Note that Shopify has removed handling of "no-js" in recent versions of Dawn, it must be "js":

https://github.com/Shopify/dawn/pull/3245 :

 

Click to expand...

Why no <noscript>?
Javascript is an integral part of the modern web. Without JS, new Shopify theme features like Combined Listings simply will not work well because they require the use of the section API to progressively load content. Additionally, Checkout Extensibility (Shopify's upgraded checkout) requires JS. There is no value in the theme letting a no-JS user add items to cart if they aren't able to checkout, it would be better to fail fast.

 

Screenshot 2024-06-20 at 2.26.54 PM.png

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
ellzmai45
Tourist
3 0 1

Thank you! I would have never thought to change that part of the code , all working now I have deleted it

JosieatNouvelle
Tourist
5 0 1

Hey Tim, 
I'm having a similar issue. Ay chance you can assist? 
Hamburger menu is no longer appearing in header, just at the base of mobile screen. This is taking up valuable real estate.
How can I add the hamburger to the Right hand side (logo on left). 
When I choose this option in shopify on the logo is present.
www.nouvelleglass.com

tim
Shopify Partner
3911 395 1440

It's not a bug, rather a theme feature. 

Potentially it's possible to place the menu button to be to the right of the logo;

however, what about the cart sticky which replaces the menu button when something is in the cart?

Screenshot 2024-07-03 at 1.53.07 PM.png  Screenshot 2024-07-03 at 1.53.13 PM.png  Screenshot 2024-07-03 at 1.53.41 PM.png

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
JosieatNouvelle
Tourist
5 0 1

Thanks for looking into it. Looks like it's only able to be adjusted/sticky for Desktop.

Screenshot 2024-07-03 at 3.20.20 PM.png

 

itactuallyfits
Tourist
10 0 7

Hello Tim,

 

Can you assist with my hamburger menu not working as well? I too had to update my Shopify theme. Here's my website: www.itactuallyfits.com. Thanks and I look forward to your reply!

tim
Shopify Partner
3911 395 1440

Briefly -- see that something is wrong with your popup. Try disabling it, if it's enabled.

If my post is helpful, consider liking it -- it will help others with similar problem to find a solution.
I can be reached via e-mail tairli@yahoo.com
itactuallyfits
Tourist
10 0 7

That did it! Thank you so much.

itactuallyfits
Tourist
10 0 7

Hello again. I need to keep the pop up enabled that’s cause the hamburger bar not to work. Is there another solution to fix this problem without dis enabling the pop up? Thank you!