Shopify themes, liquid, logos, and UX
Hey there, i want menu animations like that rafaelindiana.com (fadein) just look on mobile.
my site: lefevreandco.com
Hi @lefevreandco ,
You can edit the code in your theme to get the menu animation: You need to edit the code in the following 2 files.
+ component-menu-drawer.css file: Scroll to the bottom of the file and add the following code:
.menu-drawer__menu li {
opacity: 0;
}
+ theme.liquild file: add the following code in the same position as in the image
<script>
document.addEventListener("DOMContentLoaded", function() {
const headerIcon = document.querySelector('.header__icon');
headerIcon.addEventListener("click", function() {
const menuDrawer = document.getElementById('menu-drawer');
const menuItems = menuDrawer.querySelectorAll('.menu-drawer__menu li');
if (menuDrawer.classList.contains('expanded')) {
menuItems.forEach((menuItem, index) => {
menuItem.style.opacity = 0;
menuItem.style.transform = 'translateY(-20px)';
});
menuDrawer.classList.remove('expanded');
} else {
menuItems.forEach((menuItem, index) => {
setTimeout(() => {
menuItem.style.opacity = 1;
menuItem.style.transform = 'translateY(0)';
}, (index + 1) * 150);
});
menuDrawer.classList.add('expanded');
}
});
});
</script>
Hope it helps @lefevreandco
If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here ☕.
B2B Solution & Custom Pricing | Product Labels by BSS
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
I tried it, it worked, but it wasn't what I expected. Very artificial, and doesn't have a smooth transition. Thank you btw!
heyy, it didn't work for me. Can you help me, i want to add transition delay of 0.3s for each page in my mobile menu.
my url: https://8ea630-08.myshopify.com/
Thanks
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025