All things Shopify and commerce
I am using the Ella theme version 6-7-1- on my Shopify store, and I have encountered an issue with the mobile menu functionality.
The close button (represented by an "X") in the mobile menu is not working as expected. While the button is clickable, it does not close the menu. I have tried troubleshooting this issue but haven’t been able to resolve it. Please Help me.
Solved! Go to the solution
This is an accepted solution.
Edit theme.liquid
search for </body>
now just before to it add this code
<script>
document.addEventListener('DOMContentLoaded', function () {
// Select all elements with the class 'halo-sidebar-close'
const closeButtons = document.querySelectorAll('.halo-sidebar-close');
if (closeButtons.length > 0) {
closeButtons.forEach(button => {
// Add click event listener to each button
button.addEventListener('click', function () {
// Check if the body has the class before removing
if (document.body.classList.contains('menu_open')) {
document.body.classList.remove('menu_open');
console.log('menu_open class removed from body');
} else {
console.log('menu_open class not found on body');
}
});
});
} else {
console.error('No elements with class "halo-sidebar-close" found');
}
});
</script>
Regards
Guleria
Hello @S29 ,
Using Android and Windows it works for me.
Are you checking with IOS ?
btw try to fix the error which appears in the console
Uncaught type error...
Regards
Guleria
Can you please go in this URL => https://90408f-2.myshopify.com/
And open in mobile phone. then click on three dots for menu option, then try to click on "x" button.
Its not working even on android and also not in window..
Please help if you know how to solve the issue?
I already took your store URL from screenshots you shared.
And believe me it works fine for me.
I suggest clear the browser cache or check in the incognito window.
Regards
Guleria
This cross (x) button is not working sir. i tried in phone also and in incognito mode also. and my colleague phone also..
This is an accepted solution.
Edit theme.liquid
search for </body>
now just before to it add this code
<script>
document.addEventListener('DOMContentLoaded', function () {
// Select all elements with the class 'halo-sidebar-close'
const closeButtons = document.querySelectorAll('.halo-sidebar-close');
if (closeButtons.length > 0) {
closeButtons.forEach(button => {
// Add click event listener to each button
button.addEventListener('click', function () {
// Check if the body has the class before removing
if (document.body.classList.contains('menu_open')) {
document.body.classList.remove('menu_open');
console.log('menu_open class removed from body');
} else {
console.log('menu_open class not found on body');
}
});
});
} else {
console.error('No elements with class "halo-sidebar-close" found');
}
});
</script>
Regards
Guleria
Thank you so much. It Works. 🤗
Great btw don't hesitate to mark the solution accepted and do like the posts 😁
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024